Device Location Retrieval

This API provides the ability to retrieve the area where a certain user device is located.

The area provided in the response could be described:

  • by a circle determined by coordinates (latitude and longitude) and a radius.
  • by a simple polygon delimited by segments connecting consecutively an array of coordinates (points). The last point connects to the first point to delimit a closed shape bounded with straight sides.

The retrieved shape depends on the network conditions at the device's location and any of the supported shapes could be received.

The requester could optionally ask for a freshness of the location information by providing a location_age_seconds ("I want a location not older than 600 seconds").

The result accuracy depends on the network's ability and accuracy to locate the device.

Additionally to location information, the answer will also provide indication about the location time.

OpenAPI-Spezifikation herunterladen

Location retrieval

Retrieve the location of a device

Retrieve the location of a user’s mobile device based on their phone number

Retrieve the location of a user's mobile device

posthttps://api-eu.vonage.com/v0.1/location/retrieval

Authentifizierung

SchlüsselBeschreibungWoBeispiel
Authorization

Ihr JSON-Web-Token.
Lesen Sie mehr über JWTs

Headers

Bearer <JWT>

Anfrage Körper
Inhalt Typ
application/json

phone_number
string
Erforderlich
Beispiel+123456789

A public identifier addressing a telephone subscription. In order to be globally unique it has to be formatted in international format, according to E.164 standard, prefixed with '+'.

location_age_seconds
integer
Beispiel604800

Maximum age of the location information which is accepted for the location retrieval (in seconds). Absence of location_max_seconds means "any age" and location_max_seconds=0 means a fresh calculation.

Beispiel Anfrage

{
   "phone_number": "+123456789",
   "location_age_seconds": 604800
}

Antworten
Inhalt Typ
application/json

Location retrieval result

Einer der
last_location_time
string(date-time)
Erforderlich
Beispiel2023-10-17T13:18:23.682Z

Last date and time when the device was located. It follows the RFC 3339 including the time zone. The format is yyyy-MM-dd'T'HH:mm:ss.SSSZ (i.e. which allows 2023-07-03T14:27:08.312+02:00 or 2023-07-03T12:27:08.312Z)

location
object
Erforderlich

Location object

type
string
Erforderlich
BeispielCIRCLE

Type of area

center
object
Erforderlich

Coordinates (latitude, longitude) defining a location in a map

latitude
number(double)
Erforderlich
Min-90
Max90

Latitude component of a location

longitude
number(double)
Erforderlich
Min-180
Max180

Longitude component of location

radius_meters
number
Erforderlich
Min1
Beispiel800

Distance from the center in meters

Beispiel Antwort»Circular area

{
   "last_location_time": "2023-10-17T13:18:23.682Z",
   "location": {
      "type": "CIRCLE",
      "center": {
         "latitude": 50.735851,
         "longitude": 7.10066
      },
      "radius_meters": 800
   }
}