API:Location

From $1

Overview

At its simplest, the Location API consists of a single call, getlocation, which can be tested with a development key in the Alcatel sandbox, employing virtual user information.  But the Location API is also one piece of the powerful set of location-based services in the OAS Platform, when combined with the Subscriber options. Together, these APIs can be deployed in live applications that integrate location information taken directly from the network, along with any available location information from GPS devices. Incorporating location capabilities directly from the network means developers have greater reach and greater flexibility creating location-based apps, without the headache of trying to negotiate location services over a multitude of carriers, devices, and protocols.

To add location capabilities to a live application, it is required to first subscribe users, as described in the Subscriber API

Location-based services in the OAS rely on the integration of several systems, including:

  • The OAS platform itself, including the Location, and Subscriber API options
  • A mobile handset carrier service, such as Sprint
  • A particular mobile handset make and model. 
    • Note: If you want to integrate location data from sources other than the network, the handset will need a location client installed. 
      See Enable Location-Client Data for details
  • A location-based application developed by a third-party (you)
  • Third-party application infrastructure, including an application that calls the location-based operations and a web site that supports the callback requests. 

NOTE: The Location APIs are currently available for subscribers using Sprint in the United States.

Developing a Test Location-Based Application

To try out the location service operation with virtual users, copy the following sample request HTML and edit to add your own developer key after "appkey=”. Then paste the edited request into a browser address box.

Sample Request

http://api.openapiservice.com/v1.0/location/getLocation?appkey=&phoneNumber=19175550001&requestedAccuracy=100&acceptableAccuracy=1000&maximumAge=300000&responseTime=60000&tolerance=DELAY_TOLERANT

The virtual user targeted in this request is identified by phoneNumber, and is drawn from the 17 virtual users maintained on the OAS sandbox. Change the identifying phone number to choose a different user with different parameters, if desired, as described below.

Testing with Virtual Users

The  sandbox provides a set of virtual users whose locations can be retrieved by any application. Use this virtual data to test an application and the API by locating phones with pre-determined locations and movement patterns. To simplify testing, virtual users can be located without satisfying the subscriber opt- in requirement.

Base Locations 

The virtual users are located in multiple cities in the United States and move in predictable patterns. Each of the following cities has a group of seventeen virtual users: 

City  

Area Code  

Location (Latitude Longitude) 

New York, NY  

917  

40.74 -73.98 

Washington, DC  

202  

38.88 -77.03 

Chicago, IL  

312  

41.88 -87.63 

Dallas, TX  

214  

32.83 -96.83 

Denver, CO  

303  

39.75 -104.87 

Los Angeles, CA  

714  

34.05 -118.25 

Travel Patterns

Virtual users move in East-West or North-South direction, following a predictable pattern. Starting on the hour, all users in a given city start at the latitude and longitude listed in Table 1 . They travel at a constant speed in their assigned initial direction. After thirty minutes, users reverse direction and return to the common geographic point.

The rate of travel is determined by the maximum distance that each mobile moves in the first thirty-minutes, as shown in the table below. Note that one user in each city, 555-0000, is stationary; this supports the testing of additional use cases.

 Virtual Users by Number

Phone Number      

Initial Direction”  

Max Distance (km) 

“GPS- enabled” Accuracy 

555-0000 

None 

0 

Yes 

555-0001 

North 

2.5 

Yes 

555-0002 

South 

2.5 

Yes 

555-0003 

East 

2.5 

No 

555-0004 

West 

2.5 

Yes 

555-0005 

North 

15 

Yes 

555-0006 

South 

15 

Yes 

555-0007 

East 

15 

No 

555-0008 

West 

15 

Yes 

555-0009 

North 

30 

Yes 

555-0010 

South 

30 

Yes 

555-0011 

East 

30 

No 

555-0012 

West 

30 

Yes 

555-0013 

North 

50 

Yes 

555-0014 

South 

50 

Yes 

555-0015 

East 

50 

No 

555-0016 

West 

50 

Yes 

Accuracy Emulation 

If the device is shown as "GPS-enabled" in Table 2, the API returns a location with GPS accuracy if "acceptableAccuracy" is less than 14000 meters. Devices that are not "GPS-enabled" will only return cell-sector accuracy. The actual values of the accuracy vary, but generally, GPS accuracy is a few hundred meters and cell-sector accuracy is 12000 to 14000 meters. 

(For more information on using accuracy and delay parameters in live applications, see Accuracy and Delay Parameters.) 

Developing a Live Location-Based Application

Overview 

There are several steps involved with taking a test location-based app live:

  •  Set up a business relationship with Alcatel-Lucent and choose the relevant APIs or API bundle(s).
  •  Obtain an application key for your location-based app.
  • Develop the opt-in process for subscribers (see API:Subscriber). 
  • Optional: If your application will blend network-based location data with location data from other sources, then develop the process for subscribers to download one of the available location clients (see Enable Location-Client Data). 
  • Replace the developer key information with the application key information in your code.
  • Test the subscriber opt-in functions and live location functions on a compatible mobile device. 

Understanding RESTful Operations: Requests and Responses. 

To use location-based services in a live app, it is necessary to blend two RESTful services: a subscriber service and a location service. Your location messaging app is deployed on one (or more) of the URLs that you specified when registering for an application key.

Implement your app with your choice of programming languages and tools. Your application makes https GET requests to the OAS platform URL specified for subscriber and location operations, filling parameter values as appropriate. (A few request parameters are optional; most are required. Parameter order is not required.) Your app should expect XML responses in the same TCP session for the request. The application inspects the XML response parameters to determine its subsequent behavior.

Note on datatypes int and long: 

  • "int" : A parameter datatype with a range of -2^31 to 2^31 -1
  • "long" : A parameter datatype with a range of  -2^63 to 2^63 -1

Note: both http and https are supported.

Using getLocation  

Description 

Locates a single user. 

URL

http://api.openapiservice.com/v1.0/location/getLocation

Sample Request 

https://api.openapiservice.com/v1.0/location/getLocation? appkey=a44f2nz9ql30cpou7wev8te3&phoneNumber=19175550001
&requestedAccuracy=100&acceptableAccuracy=1000&maximumAge=300000&responseTime=60000&tolerance=DELAY_TOLERANT

Request Message Parameters  

Parameter name 

Parameter type 

Description 

appkey 

string 

Unique application authentication key 

phoneNumber 

long (ensures no non-numerals included)  

Phone number of the user to be located, including country code 

requestedAccuracy 

int 

Requested accuracy, specified as a radius in meters. A value of 0 means that no particular accuracy is requested 

acceptableAccuracy 

int 

Acceptable accuracy, specified as a radius in meters. A value of 0 means that any accuracy is acceptable. If a non-zero value is specified, then it must be greater than or equal to that of  requestedAccuracy. 

maximumAge 

long 

Maximum acceptable age of the location, in milliseconds. A value of 0 means that any age is acceptable 

responseTime 

long 

Number of milliseconds that the 3PA can wait for a response. A value of 0 means that the response time is unbounded 

tolerance 

string  (DelayTolerance) 

Priority of response time versus accuracy. See Accuracy and Delay Parameters for more detail.  

Possible Values:  

NO_DELAY - Indicates that the server should immediately return any location estimate that it currently has. If no estimate is available, the server returns the exception code and may optionally initiate procedures to obtain a location estimate (e.g. to be available for a later request). 

LOW_DELAY - Indicates that fulfillment of the response time requirement takes precedence over fulfillment of the accuracy requirement. The server shall return any current location estimate with minimum delay. The server shall attempt to fulfill any accuracy requirement, but in doing so shall not add any additional delay (i.e. a quick response with lower accuracy is more desirable than waiting for a more accurate response). 

DELAY_TOLERANT - Indicates that fulfillment of the accuracy requirement takes precedence over fulfillment of the response time requirement. If necessary, the server should delay providing a response until the accuracy requirement of the requesting application is met. The server shall obtain a current location with regard to fulfilling the accuracy requirement. 

Example of Success Response

<ns:getLocationResponse xmlns:ns="http://service.las.alu.com/xsd">
  <ns:return>SU100</ns:return>
<ns:reason>Success</ns:reason>
<ns:phoneNumber>19175550001</ns:phoneNumber>
  <ns:location>
    <ns:latitude>41.0355</ns:latitude>
    <ns:longitude>-82.2419</ns:longitude>
    <ns:altitude>0.0</ns:altitude>
    <ns:accuracy>150</ns:accuracy>
    <ns:timestamp>1242399982540</ns:timestamp>
  </ns:location>
</ns:getLocationResponse>

Example of Failure Response

<ns:getLocationResponse xmlns:ns="http://service.las.alu.com/xsd">
  <ns:return>RE405</ns:return>
  <ns:reason>Subscriber 19175550001 not found</ns:reason>
  <ns:phoneNumber>19175550001</ns:phoneNumber>
</ns:getLocationResponse>

Response Message Parameters 

The response message contains XML content with the following parameters: 

Parameter name 

Parameter type 

Description 

return  

string 

Operation return code – see Return Codes for details. 

reason 

string 

Text description of command status 

phoneNumber 

long 

Phone number of the user, including country code 

location 

LocationResult 

Location data 

  

Location data parameters: 

Parameter name 

Parameter type 

Description 

latitude 

float 

Latitude in decimal degrees (-90.0 to 90.0) 

longitude 

float 

Longitude in decimal degrees (-180.0 to 180.0) 

altitude 

float 

Altitude in meters from mean sea level.  A value of 0.0 may indicate that the altitude is undetermined 

accuracy 

integer 

Accuracy in meters 

timestamp 

long 

Time when the location was determined, in milliseconds since Jan 1 1970 00:00:00.000 UTC 

Location-Client Information

The OAS Platform can retrieve subscriber location data from users’ mobile carriers (the network) or from subscribers' handsets. Incorporating both sources of data into your location-based app offers greater flexibility and accuracy. In order to use location data from a subscriber handset, the subscriber must download an OAS-compatible location client during the opt-in process. See Subscriber API and Enable Location-Client Data for details.

Return Codes

See LBS Return Return Codes & Troubleshooting to reference response codes for Location and Subscriber APIs.

Tags:
 
Comments (0)
You must login to post a comment.