# Sample TPS XML API request

Source: [https://docs.qualcomm.com/doc/80-42216-1/topic/21_Sample_TPS_XML_API_for_testing.html](https://docs.qualcomm.com/doc/80-42216-1/topic/21_Sample_TPS_XML_API_for_testing.html)

### About this task

To issue a Terrestrial Positioning Service (TPS) XML API request or to test using Python or cURL
        commands, perform the following steps:

### Procedure

1. Create a file named location\_rq.xml with the following sample XML
          request body:
        
<LocationRQ xmlns="http://skyhookwireless.com/wps/2005"
                    version="2.31"
                    street-address-lookup="none">
        <authentication version="2.2">
        <key key="YOUR API KEY HERE"
             username="DEVICE SERIAL NUM, MAC ADDRESS, OR OTHER UNIQUE ID HERE"/>
        </authentication>
           <access-point>
                <mac>E2557D913550</mac>
                <ssid>Skyhook-1400</ssid>
                <signal-strength>-41</signal-strength>
                <age>1000</age>
                <freq>2437</freq>
            </access-point>
            <access-point>
                <mac>E2557D60E470</mac>
                <ssid>Skyhook-1400</ssid>
                <signal-strength>-43</signal-strength>
                <age>1000</age>
                <freq>5520</freq>
            </access-point>
            <access-point>
                <mac>E2556D63C520</mac>
                <ssid>Skyhook-1400</ssid>
                <signal-strength>-70</signal-strength>
                <age>1000</age>
                <freq>2462</freq>
            </access-point>
            <lte-tower>
                <mcc>311</mcc>
                <mnc>480</mnc>
                <tac>25828</tac>
                <eucid>25919502</eucid>
                <pci>210</pci>
                <rssi>-50</rssi>
                <timing-advance>0</timing-advance>
                <age>0</age>
                <earfcn>1000</earfcn>
                <serving>true</serving>
            </lte-tower>
            <ibeacon-ble>
                <uuid>f7826da6-4fa2-4e98-8024-bc5b71e0893e</uuid>
                <major>58966</major>
                <minor>39642</minor>
                <company-id>1400</company-id>
                <mac>F7293682CB2B</mac>
                <rssi>-89</rssi>
                <age>280</age>
                <tx-power>-77</tx-power>
            </ibeacon-ble>
            <eddystone-uid-ble>
                <namespace-id>f7826da6bc5b71e0893e</namespace-id>
                <instance-id>6a573133467a</instance-id>
                <mac>CF890377C033</mac>
                <rssi>-90</rssi>
                <age>1000</age>
                <ranging-data>-36</ranging-data>
            </eddystone-uid-ble>
        </LocationRQ>
        Copy to clipboard
2. To test using Python, submit the file using the following Python script:
        
python WPS_API.py   C:\path\to\file\location_rq.xmlCopy to clipboard

Ensure that the requests library is available for the script to
          run properly.

        #WPS_API.py
        
        import sys
        import os.path
        import requests
        
        # Need file name, index of ip & newline
        if len (sys.argv) < 2:
                print "USAGE: {} <xml filename>".format(sys.argv[0])
                exit(-1)
        in_filename = sys.argv[1]
        
        # Open input and output file streams
        in_file = open(in_filename, "r")              
        
        # Begin processing IP addresses
        print "Script started"    
        print "Analyzing Log File"
        
        # Read in xml file
        xml_string = in_file.read()   
        
        # HTML headers
        headers = {'Content-Type': 'text/xml'}

        # Make the request to the Precision location API
        r = requests.post('https://global.skyhookwireless.com/wps2/location', data=xml_string, 
        headers=headers)print r.text
        
        print "Script finished"                 
        
        # Close input and output file streams
        in_file.close()
        Copy to clipboard
3. To test using cURL, submit the file using a cURL command-line tool with the following
          syntax (all in one line):
        
curl -H "Content-Type: text/xml" -H "X-Forwarded-For: 127.0.0.1" -d 
        @location_rq.xml https://global.skyhookwireless.com/wps2/locationCopy to clipboard

Note: Ensure that the command is formatted properly without any
            whitespaces when using cURL.

Last Published: Apr 01, 2026

[Previous Topic
TPS XML API response](https://docs.qualcomm.com/bundle/publicresource/80-42216-1/topics/19_TPS_XML_API_response.md) [Next Topic
Evaluate TPS XML API](https://docs.qualcomm.com/bundle/publicresource/80-42216-1/topics/26_Guidelines_to_evaluate_TPS_XML_API.md)