Device Location Retrieval

Access reliable geographical position data to enhance location-based features in applications

Location
Network API
Camara
Playground

Introduction

The CAMARA Device Location Retrieval API allows API consumers to retrieve the area where a device is located.

The CAMARA specification defines two possible shapes for the returned area:

  • a circle, defined by its center coordinates and radius;
  • a polygon, defined by an array of coordinates describing its boundary.

Orange implementation: the API returns the location area as a circle only. Although the CAMARA specification also defines polygon responses, polygon responses are not supported by this implementation.

The response also includes the time at which the device was last located.

The CAMARA specification allows API consumers to request:

  • a maximum age for the location information using maxAge;
  • a maximum area size using maxSurface.

Orange implementation: maxAge is supported. maxSurface is not supported and must not be included in the request body.

Location is sensitive data in many jurisdictions. The API consumer must ensure that the required user consent and other applicable legal requirements are met before requesting location information.

API Authentication

HTTPS requests to the REST API are protected with CIBA 3-Legged OAuth.

Before calling the Device Location Retrieval API, the API Invoker (for example, an application backend or aggregator) must request a Three-Legged Access Token from the Orange Authorization Server. The process follows the OpenID Connect Client-Initiated Backchannel Authentication (CIBA) flow.

This API is called with a 3-legged access token. The device is identified from the access token, so do not include a device object in the API request body.

Step 1: Request backchannel authorization

Send a POST request to the bc-authorize endpoint. The request must include the required parameters and a valid user identifier in login_hint.

The API Invoker provides the application credentials (client_assertion and client_assertion_type) and declares the purpose for processing personal data. For Device Location Retrieval, use the following scope:

openid dpv:FraudPreventionAndDetection location-retrieval:read

The current Orange implementation supports the dpv:FraudPreventionAndDetection purpose.

Note on JWT usage via client assertion: client_assertion is a JWT used by the client to authenticate to the authorization server. client_assertion_type identifies the assertion type. The API consumer must configure a JWK keystore in the application settings in Orange Developer.

curl -X POST "https://auth.networkapi.service.orange/realms/osp/protocol/openid-connect/ext/ciba/auth" \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data-urlencode 'login_hint=tel:+346xxxxxxxx' \
  --data-urlencode 'client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer' \
  --data-urlencode 'client_assertion=eyJhbGciOi...zif0Tjxzw' \
  --data-urlencode 'scope=openid dpv:FraudPreventionAndDetection location-retrieval:read'

The Orange Authorization Server returns an authorization request ID:

200
Content-Type: application/json
{
  "auth_req_id": "69957d77-fea4-4a4c-8cd2-b29f22e61307",
  "interval": 2,
  "expires_in": 120
}

The authorization request ID may be returned before the end user has provided consent.

Step 2: Request the OAuth access token

After receiving the authorization request ID, send a POST request to the token endpoint to obtain an access token.

curl -X POST "https://auth.networkapi.service.orange/realms/osp/protocol/openid-connect/token" \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data-urlencode 'client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer' \
  --data-urlencode 'client_assertion=eyJhbGciOi...zif0Tjxzw' \
  --data-urlencode 'auth_req_id=69957d77-fea4-4a4c-8cd2-b29f22e61307' \
  --data-urlencode 'grant_type=urn:openid:params:grant-type:ciba'

If the transaction succeeds, the response contains an access token:

200
Content-Type: application/json
{
  "access_token": "*****",
  "token_type": "Bearer",
  "expires_in": 119
}

Step 3: Call the protected API

Include the access token in the Authorization header when calling the Device Location Retrieval API.

API Description

Summary of resources

The API exposes one resource: retrieve. It retrieves the location area of the device identified by the access token.

The CAMARA specification defines both circle and polygon areas. The Orange implementation returns circles only; polygon responses are not supported.

Summary of methods and URL

Use caseMethod and URL
Retrieve the location area of the device identified by the access tokenPOST https://networkapi.service.orange/camara/osp/location-retrieval/v0.4/retrieve

Device Location - Retrieve

Request body parameters

NameDescriptionTypeMandatoryOrange implementation
maxAgeMaximum age of the location information accepted by the consumer, in seconds. If omitted, any age is acceptable. A value of 0 requests a fresh location.integerNoSupported
maxSurfaceMaximum surface area, in square meters, accepted by the consumer.integerNoNot supported. Do not include this parameter.

The device is identified from the 3-legged access token. Do not include a device object in the request body.

Example request body

{
  "maxAge": 120
}

To accept location information of any age, omit maxAge and send an empty JSON object:

{}

Do not include maxSurface in the request body. Although this parameter is defined in the CAMARA specification, it is not supported by the Orange implementation.

Request

curl -X POST "https://networkapi.service.orange/camara/osp/location-retrieval/v0.4/retrieve" \
  --header "Authorization: Bearer {your access token}" \
  --header "Cache-Control: no-cache" \
  --header "Accept: application/json" \
  --header "Content-Type: application/json" \
  --data '{
    "maxAge": 120
  }'

Successful response

The CAMARA specification permits circle or polygon responses. The Orange implementation returns a circle only.

200 OK
Content-Type: application/json
{
  "lastLocationTime": "2023-10-17T13:18:23.682Z",
  "area": {
    "areaType": "CIRCLE",
    "center": {
      "latitude": 45.754114,
      "longitude": 4.860374
    },
    "radius": 800
  }
}

Response fields

NameDescriptionTypeMandatory
lastLocationTimeDate and time when the device was last located. The value follows RFC 3339 and includes a time zone.string (date-time)Yes
areaLocation area returned by the network. The specification allows a circle or a polygon; the Orange implementation returns a circle only.objectYes
area.areaTypeShape used to represent the location area. In the Orange implementation, this is always CIRCLE.stringYes
area.centerCenter coordinates of the returned circle.objectYes
area.center.latitudeLatitude of the circle center, between -90 and 90.numberYes
area.center.longitudeLongitude of the circle center, between -180 and 180.numberYes
area.radiusRadius of the returned circle, in meters.numberYes

Notes on maxAge

  • If maxAge is omitted, location information of any age is acceptable. The response includes lastLocationTime.
  • If maxAge is 0, a fresh location is requested.
  • If the freshness requirement cannot be met, the API may return 422 LOCATION_RETRIEVAL.UNABLE_TO_FULFILL_MAX_AGE.
  • If the device cannot be located, the API may return 404 LOCATION_RETRIEVAL.DEVICE_NOT_FOUND.

Most frequent errors

Invalid request

Invalid input can result in a 400 INVALID_ARGUMENT response.

{
  "status": 400,
  "code": "INVALID_ARGUMENT",
  "message": "Client specified an invalid argument, request body or query param."
}

Device not found

If the location server cannot locate the device, the API may return 404 LOCATION_RETRIEVAL.DEVICE_NOT_FOUND.

{
  "status": 404,
  "code": "LOCATION_RETRIEVAL.DEVICE_NOT_FOUND",
  "message": "The location server is not able to locate the mobile"
}

Identifier not found

If the device identifier cannot be matched to a device, the API may return 404 IDENTIFIER_NOT_FOUND.

{
  "status": 404,
  "code": "IDENTIFIER_NOT_FOUND",
  "message": "Device identifier not found."
}

Unable to fulfill maxAge

If the API cannot provide location information that meets the requested maxAge, it may return 422 LOCATION_RETRIEVAL.UNABLE_TO_FULFILL_MAX_AGE.

{
  "status": 422,
  "code": "LOCATION_RETRIEVAL.UNABLE_TO_FULFILL_MAX_AGE",
  "message": "Unable to provide expected freshness for location"
}

Missing or unnecessary identifier

With a 3-legged access token, the device must be identified from the token. If it cannot be identified, the API may return 422 MISSING_IDENTIFIER.

{
  "status": 422,
  "code": "MISSING_IDENTIFIER",
  "message": "The device cannot be identified."
}

Do not include a device object in the request body. If the device is already identified from the access token and a device object is also provided, the API may return 422 UNNECESSARY_IDENTIFIER.

{
  "status": 422,
  "code": "UNNECESSARY_IDENTIFIER",
  "message": "The device is already identified by the access token."
}

Authentication and permission errors

If the access token is missing, invalid, or expired, the API returns 401 UNAUTHENTICATED. Request a valid access token and retry.

{
  "status": 401,
  "code": "UNAUTHENTICATED",
  "message": "Request not authenticated due to missing, invalid, or expired credentials."
}

If the client does not have permission to call the API, the API returns 403 PERMISSION_DENIED. Check the application’s API subscription and ensure that the access token has the required scope:

location-retrieval:read

{
  "status": 403,
  "code": "PERMISSION_DENIED",
  "message": "Client does not have sufficient permissions to perform this action."
}