Announcement: Contribution API v1 has been deprecated as 31st August, 2016. Contribution API v2 is now publicly available.

Contribution API v1 Documentation

Table of Contents

  1. Usage
  2. Endpoint
  3. Request
  4. Response
  5. Examples:

Usage

Requests are sent to the following endpoint:

http://d1.unwiredlabs.com/submit.php?{REQUEST_BODY}

The request body is a GET request. The format is:

?token={token}&lat={lat}&lon={lon}&acc={acc}&alt={alt}&alta={alta}&time={time}&cells={scell};{ncell1};...{ncell_N};&wifi={wifi1};{wifi2};...{wifi_N};

Request

Send the following data as a GET request. (Fields with * are mandatory)

  • token* - Your API token. If you don't have one, contact us here!
  • cells* - A list of Cell Tower objects visible to the device, separated by semi-colons (;).
    Each object (scell or ncell) comprises parameters of that tower, separated by commas (,). You can send a minimum of 0 and a maximum of 7 cell ID objects. The first cell object (scell) has to be that of the serving cell, i.e. the tower the device is connected to. The others (ncell) are neighbouring cell objects that are visible to the device.
    • Each Cell Tower object is in this format:
      radio,mcc,mnc,lac,cid,psc,signal,tA,asu;
    • The parameters in the object are:
      • radio* - Radio type of the device. Supported values are 'g' for GSM, 'c' for CDMA, 'u' for UMTS and 'l' for LTE
      • mcc* - Mobile country code (MCC) of the cell
      • mnc* - Mobile network code (MNC) of the cell. On CDMA, it’s the System ID (SID).
      • lac* - Location Area Code of your operator's network (GSM/UMTS). On CDMA, it's the Network ID (NID) Value should be in decimal format
      • cid* - On GSM, it's the Cell ID (CID). On CDMA, it's the Base station ID (BID) or Station ID (SID). On UMTS, it's the UTRAN/GERAN Cell Identity (UC-Id). Value should be in decimal format
      • psc - Physical Cell ID on LTE. Primary scrambling code on UMTS (Optional)
      • signal - Signal strength of the radio, measured in dBm (Optional)
      • tA - Timing Advance value (Optional)
  • wifi* - A list of WiFi objects visible to the device, separated by semi-colons (;). You can send a minimum of 0 and a maximum of 10 WiFi objects in 1 request.
    • bssid* - Base Service Set ID or MAC address of the Access Point; can be sent with or without the separators (; or .)
    • channel - Channel the WiFi network is operating in (optional)
    • frequency - Frequency the WiFi network is operating in (optional)
    • signal - Signal strength of the WiFi network, measured in dBm (optional)
  • lat* - latitude of the location in decimal format (e.g. 17.0102911) with a precision of 7 decimal places
  • lon* - longitude of the location in decimal format (e.g. 78.0102911) with a precision of 7 decimal places
  • acc - accuracy of the location in meters if provided by the GPS device
  • alt - altitude of the location in meters if provided by the GPS device
  • alta - accuracy of the altitude in meters if provided by the GPS device
  • sbox* - if this parameter is not set, the API is in sandbox mode. Data is submitted to the server only if the parameter is set to 0 (zero).
  • time - date and time the measurements were taken in MySQL format (YYYY-MM-DD HH:MM:SS)
Notes:
  • You must submit at least one valid cell or WiFi object and a location
Sample request:
http://d1.unwiredlabs.com/submit.php?token=demo&cells=g,404,49,58,693,0,0,0;g,405,25,17161,16803;&lat=39.568732&lon=-105.002939&wifi=00:1c:10:9a:3c:21,0,2437,-80;&acc=50&alta=50&alt=460&time=2014-04-01 00:00:00&sbox=1

Response body

The response will be a JSON object.
  • status - If the request is successful, "ok" is returned. Otherwise "error" is returned
  • message - Any additional information from the server is returned here

If the request is successful, the server returns:

{
    "status": "ok",
    "message": "Measures submitted"
}

If there's an error - for example, an invalid token - the server returns:

{
    "status": "error",
    "message": "Invalid or inactive token"
}

 Example script - PHP