# Sample TPS JSON API request

Source: [https://docs.qualcomm.com/doc/80-42204-1/topic/sample-aps-json-api-request.html](https://docs.qualcomm.com/doc/80-42204-1/topic/sample-aps-json-api-request.html)

### About this task

To issue a Terrestrial Positioning Service (TPS) JSON API request or to test, perform the
                following steps:

### Procedure

1. Create a file named location\_rq.json with the following sample
          requests:
        
- Wi-Fi only sample request

            {
              "considerIp": "false",
              "hpeConfidence": 68,
              "includeLocationSource": "true",
              "includeBeaconCounts": "true",
              "streetAddressLookupType": "none",
            
                "wifiAccessPoints": [
                    {
                        "macAddress": "E2:55:7D:91:35:50",
                        "ssid": "Network ABC",
                        "signalStrength": -63,
                        "age": 0,
                        "frequency": 2437,
                        "connected": true
                    },
                    {
                        "macAddress": "E2:52:7D:81:35:51",
                        "ssid": "Network 123",
                        "signalStrength": -50,
                        "age": 351,
                        "frequency": 2462,
                        "connected": false
                    },
                    {
                        "macAddress": "DA:55:A8:1E:F0:4F",
                        "ssid": "Network 456",
                        "signalStrength": -78,
                        "age": 5,
                        "frequency": 2437,
                        "connected": false
                    }
                ]
            }Copy to clipboard
    - Cell only sample request

            {
              "considerIp": "false",
              "hpeConfidence": 68,
              "includeLocationSource": "true",
              "includeBeaconCounts": "true",
              "streetAddressLookupType": "none",
            
                "cellTowers": [
                    {
                        "neighborId": 75,
                        "mobileCountryCode": 440,
                        "mobileNetworkCode": 52,
                        "SignalStrength": -102,
                        "channel": 5900,
                        "locationAreaCode": 714,
                        "cellId": 171276810,
                        "radioType": "lte",
                        "serving": true
                    },
                    {
                        "radioType": "lte",
                        "neighborId": 77,
                        "signalStrength": -99,
                        "channel": 5900,
                        "serving": false
                    }
                ]
            }Copy to clipboard
    - Wi-Fi + Cell only sample
                            request

            {
                "considerIp": "false",
                "hpeConfidence": 68,
                "includeLocationSource": "true",
                "includeBeaconCounts": "true",
                "streetAddressLookupType": "none",
                "cellTowers": [
                    {
                        "radioType": "lte",
                        "mobileCountryCode": 311,
                        "mobileNetworkCode": 480,
                        "locationAreaCode": 25828,
                        "cellId": 25919502,
                        "neighborId": 210,
                        "timingAdvance": 1,
                        "signalStrength": -50,
                        "age": 533,
                        "channel": 1000,
                        "serving": true
                    }
                ],
                "wifiAccessPoints": [
                    {
                        "macAddress": "E2:55:7D:91:35:50",
                        "ssid": "Network ABC",
                        "signalStrength": -63,
                        "age": 0,
                        "frequency": 2437,
                        "connected": true
                    },
                    {
                        "macAddress": "E2:52:7D:81:35:51",
                        "ssid": "Network 123",
                        "signalStrength": -50,
                        "age": 351,
                        "frequency": 2462,
                        "connected": false
                    },
                    {
                        "macAddress": "DA:55:A8:1E:F0:4F",
                        "ssid": "Network 456",
                        "signalStrength": -78,
                        "age": 5,
                        "frequency": 2437,
                        "connected": false
                    }
                ]
            }Copy to clipboard
2. Submit the file using a cURL command-line tool with the following syntax (all in one
          line):
        
curl -i -v -H "Content-Type: application/json" 
        -d@location_rq.json https://global.skyhookwireless.com/wps2/json/location?
        key="<YOUR API KEY>&user=<DEVICE SERIAL NUM, MAC ADDRESS, OR OTHER UNIQUE ID>"Copy to clipboard

## API status codes

Source: [https://docs.qualcomm.com/doc/80-42204-1/topic/sample-aps-json-api-request.html](https://docs.qualcomm.com/doc/80-42204-1/topic/sample-aps-json-api-request.html)

The Terrestrial Positioning Service (TPS) JSON API uses standard HTTP status codes to provide
                high-level category of error and additional details as to the nature of the error in
                the response JSON object. You can use these details to provide appropriate feedback
                for user experience and debugging.

The following table provides a list of observable HTTP status codes for the TPS JSON API
                request.

Table : HTTP status codes for TPS JSON API

| Status code | Response | Description |
| --- | --- | --- |
| `200` | `Success` | Valid request with location result. |
| `400` | `Bad Request` | Parse error due to invalid JSON. |
| `400` | `Bad Request` | No valid signal data. |
| `401` | `Unauthorized` | – |
| `403` | `Forbidden` | A request is made to a secured resource without<br>                                authentication. |
| `403` | `Forbidden` | Request is throttled based on licensing terms or usage<br>                                limits. |
| `404` | `Not Found` | A request is made to a nonexistent endpoint. |
| `404` | `Not Found` | Unable to determine the location with the request made. |
| `500` | `Internal Server Error` | – |
| `503` | `Service Unavailable` | – |

## API error responses

Source: [https://docs.qualcomm.com/doc/80-42204-1/topic/sample-aps-json-api-request.html](https://docs.qualcomm.com/doc/80-42204-1/topic/sample-aps-json-api-request.html)

In the JSON interface, errors are organized in the following structure:

    {
      "error": {
        "errors":[
          {
            "domain": "<class of error>",
            "reason": "<error text>",
            "message": "<short description of error>"
          }
        ],
        "code": <status code>,
        "message": "<short description of error>"
      }
    }Copy to clipboard

Where:

- `domain` provides the classification for the associated error response.
          Most observed domains are `global`, `geolocation`,
            `usageLimits`, and `internalServer`.
- `reason` describes the particular error type.
- `message` provides the short description of the error.

### Sample error responses

A sample error response for incorrectly formatted JSON is as follows:

    {
        "error": {
            "errors": [
                {
                    "domain": "global",
                    "reason": "parseError",
                    "message": "Parse Error"
                }
            ],
            "code": 400,
            "message": "Parse Error"
        }
    }Copy to clipboard

A sample error response for correctly formatted JSON but doesn't contain valid signal data
        is as follows:

    {
      "error": {
        "errors":[
          {
            "domain": "geolocation",
            "reason": "invalidRequest",
            "message": "At least one ap/cell/gps required"
          }
        ],
        "code": 400,
        "message": "At least one ap/cell/gps required "
      }
    }Copy to clipboard

A sample error response for invalid authentication key is as follows:

    {
      "error": {
        "errors":[
          {
            "domain": "usageLimits",
            "reason": "keyInvalid",
            "message": "Unauthorized"
          }
        ],
        "code": 401,
        "message": "Unauthorized"
      }
    }Copy to clipboard

A sample error response for valid requests but location results couldn't be determined is
        as follows:

    {
      "error": {
        "errors":[
          {
            "domain": "geolocation",
            "reason": "notFound",
            "message": "Unable to determine location with request provided"
          }
        ],
        "code": 404,
        "message": "Unable to determine location with request provided"
      }
    }Copy to clipboard

Last Published: Mar 17, 2026

[Previous Topic
TPS JSON API response](https://docs.qualcomm.com/bundle/publicresource/80-42204-1/topics/19_TPS_JSON_API_response.md) [Next Topic
Token-based registration](https://docs.qualcomm.com/bundle/publicresource/80-42204-1/topics/24_Token_based_registration_using_a_license.md)