.wpb_animate_when_almost_visible { opacity: 1; }

Network APIs Playground - Geofencing 0.3

This API enables developers to prototype and validate various use cases in real-time, without impacting live systems. It provides mock up of all Network APIs following CAMARA standard.

Contact us

Getting started



Disclaimer (sandboxed version)

This Network APIs Playground - Geofencing API is a mocked version of the production-grade CAMARA - Geofencing API from CAMARA device location API family.

To use this API, subscribe to Network APIs Playground

This playground version provides responses for:

  • predefined phone numbers associated with the unassigned country code +990 (e.g +99012345678)
  • user-defined phone numbers added using the Network APIs Playground - Admin API

This API could be suspended or upgraded any time without any notice.

Introduction

The CAMARA Geofencing API provides a standardized mechanism for managing geofencing notification subscription. As API consumer you will be able to subscribe to get notification when a given device is entering of leaving a given geographical area. During the subscription request, the consumer will provide the device identifier, the area definition (as a circle) and the URL where the notification will be posted.

Using the API

Subscribe to the API

You get the Authorization header credentials when you register your application on the Orange Developer Console.

API Authentication

Note: In production environment the Geofencing API will require a 3-Legged OAuth 2.0 flow but as this implementation is provided on the Playground, the API works with a 2-Legged OAuth (OAuth 2.0 with Client Credentials grant type).

To learn more about how Orange Developer handles authentication, please refer to our documentation.

In short, you will use your Orange Developer Authorization header as authorization_header for the Basic authentication with Orange Developer.

curl -X POST \
-H "Authorization: {{ authorization_header }}" \
-d "grant_type=client_credentials" \
https://api.orange.com/camara/playground/openidconnect/v1.0/token

In response, you will get an access_token.

{
       "token_type": "Bearer",
       "access_token": "eyJ2ZXIiOiIxLjAiLCJ0eXAiOiJKV1Q.....ODSHIjf",
       "expires_in": "3600"
}

API Description

Subscription management

Summary of resources

This API has one resource subscriptions. The API allows to request subscriptions creation but also for a given API client to retrieve them and delete them.

Summary of methods and URL

Use case of operationURL method
I want to create a geofencing subscription to receive notification(s) on a specified URL, for a phone number and a geographical areaPOST "https://api.orange.com/camara/playground/api/geofencing/v0.3/subscriptions"
I want to retrieve the list of my geofencing subscription(s)GET "https://api.orange.com/camara/playground/api/geofencing/v0.3/subscriptions"
I want to terminate one (of mine) geofencing subscriptionDELETE "https://api.orange.com/camara/playground/api/geofencing/v0.3/subscriptions/{subscriptionsId}"

Summary of subscriptions body parameters

NameDescriptionTypeMandatory
protocolIdentifier of a delivery protocol. Only HTTP is allowed for now.StringYes
sinkThe address to which events shall be delivered using the selected protocolStringYes
sinkCredentialThe type of the credential. if valued only ACCESSTOKEN is managed. See extension to provide if this field is valued.stringNo
typesType of event subscribed:
- area-entered: Event triggered when the device enters the given area.
- area-left: Event triggered when the device leaves the given. Current implementation mandates to provide only one value
stringYes
configAn object to define the subscription detailSee below information on config detailYes
idIdentifier of the event subscription - This attribute must not be present in the POST request as it is provided by API server.StringYes in response
startsAtDate when the event subscription will begin/began. This attribute must not be present in the POST request as it is provided by API server.Provided in date-time format.No
expiresAtDate when the event subscription will expire. This attribute must not be present in the POST request as it is provided by API server.Provided in date-time format.No
statusCurrent status of the subscription - Management of Subscription State engine is not implemented in our lab.StringNo
Access Token extension schema:
NameDescriptionTypeMandatory
accessTokenOAuth2 token to be used by the callback API endpoint. It MUST be indicated within HTTP Authorization header e.g. Authorization: Bearer $notificationAuthTokenstringYes
accessTokenExpiresUtcAn absolute UTC instant at which the token shall be considered expired.string (datetime)Yes
accessTokenTypeMust be valued to bearer.stringYes
Definition of the Config structure:

Following table provide details about config structure:

NameDescriptionTypeFormat
subscriptionDetailsThe detail of the requested event subscriptionSee below information on subscriptionDetails detailYes
subscriptionExpireTimeThe time when the location-tracking has to be terminated (e.g. in 2 days from now on) - provided by the API consumer.Provided in date-time format.No
subscriptionMaxEventsIdentifies the maximum number of event reports to be generated (>=1) requested by the API consumer - Once this number is reached, the subscription ends.IntegerNo
initialEventSet to true by API consumer if consumer wants to get an event as soon as the subscription is created and current situation reflects event request. Example: Consumer request area entered event. If consumer sets initialEvent to true and device is already in the geofencing area, an event is triggeredBooleanNo
Definition of the subscriptionDetails structure:
NameDescriptionTypeMandatory
deviceAn object with four fields, each of them make possible to pass device identifier in different format: networkAccessIdentifier, phoneNumber, ipv4Address and ipv6AddressSee below information on deviceYes
areaUsed to define the geographical area to be monitored.See below information on areaYes
Definition of the device structure:

Following table provide details about device:

NameTypeFormat
networkAccessIdentifierstringExternal Identifier format of the GPSI
phoneNumberstringSubscriber number in E.164 format (starting with country code). Mandatory prefixed with '+'
Ipv4AddressstringIPv4 address may be specified in form <address/mask>. If address, we expect an IPv4 number in dotted-quad form 1.2.3.4. Only this exact IP number will match the flow control rule. If address/mask - an IP number as above with a mask width of the form 1.2.3.4/24.
Ipv6AddressstringIPv6 address, following IETF 5952 format, may be specified in form <address/mask>. If address, the /128 subnet is optional for single address (2001:db8:85a3:8d3:1319:8a2e:370:7344 or 2001:db8:85a3:8d3:1319:8a2e:370:7344/128). If address/mask, an IP v6 number with a mask (2001:db8:85a3:8d3::0/64 or 2001:db8:85a3:8d3::/64 )
Definition of the area structure:
NameDescriptionTypeMandatory
areaTypeType of this area. Only CIRCLE value is managedstringYes
centerStructure to define circle center coordinatesSee below information on centerYes
radiusAccuracy expected for location verification in meters. Must between 2 000 and 200 000.numberYes
Definition of the center structure:
NameDescriptionTypeMandatory
latitudeLatitude component of location. Must between -90 and 90.numberYes
longitudeLongitude component of location. Must be between -180 and 180.numberYes

Example of body request:

{
  "protocol": "HTTP",
  "sink": "https://notificationSendServer12.supertelco.com",
  "types": [
    "org.camaraproject.geofencing-subscriptions.v0.area-entered"
  ],
  "config": {
    "subscriptionDetail": {
      "device": {
        "phoneNumber": "+33699901032"
      },
      "area": {
        "areaType": "CIRCLE",
        "center": {
          "latitude": "48.80",
          "longitude": "2.259"
        },
        "radius": 2000
      }
    },
    "initialEvent": true,
    "subscriptionMaxEvents": 10,
    "subscriptionExpireTime": "2024-03-22T05:40:58.469Z"
  }
}

Lab implementation specific:

Following fixed phone number can be used (or you can create new ones using the Network APIs Playground - Admin API):

Phone Number
+99012345678
+990111222333

request geofencing subscription creation (from MSISDN)

Request
curl -X POST "https://api.orange.com/camara/playground/api/geofencing/v0.3/subscriptions"
-H "Authorization: Bearer {your access token}"
-H "Cache-Control: no-cache"  
-H 'accept: application/json'
-H 'Content-Type: application/json'
-d  '{
  "protocol": "HTTP",
  "sink": "https://notificationSendServer12.supertelco.com",
  "types": [
    "org.camaraproject.geofencing-subscriptions.v0.area-entered"
  ],
  "config": {
    "subscriptionDetail": {
      "device": {
        "phoneNumber": "+99012345678"
      },
      "area": {
        "areaType": "CIRCLE",
        "center": {
          "latitude": "48.80",
          "longitude": "2.259"
        },
        "radius": 2000
      }
    },
    "initialEvent": true,
    "subscriptionMaxEvents": 10,
    "subscriptionExpireTime": "2024-03-22T05:40:58.469Z"
  }
}
Response
201 created
Content-Type: application/json
{
  "protocol": "HTTP",
  "sink": "https://endpoint.example.com/sink",
  "sinkCredential": {
    "credentialType": "PLAIN"
  },
  "types": [
    "string"
  ],
  "config": {
    "subscriptionDetail": {
      "device": {
        "phoneNumber": "+99012345678"
      },
      "area": {
        "areaType": "CIRCLE",
        "center": {
          "latitude": "48.80",
          "longitude": "2.259"
        },
        "radius": 2000
      }
    },
    "subscriptionExpireTime": "2023-01-17T13:18:23.682Z",
    "subscriptionMaxEvents": 5,
    "initialEvent": true
  },
  "id": "1119920371",
  "startsAt": "2024-07-11T19:08:47.612Z",
  "expiresAt": "2024-07-11T19:08:47.612Z",
  "status": "ACTIVE"
}

Go up

retrieve geofencing subscription list

All subscriptions created from the requesting client_id are provided. In the response, an array of subscriptions is provided. The complete representation of the subscription resource is provided (same structure as POST response)

Request
curl -X GET "https://api.orange.com/camara/playground/api/geofencing/v0.3/subscriptions"
-H "Authorization: Bearer {your access token}"
-H "Cache-Control: no-cache"  
-H 'accept: application/json'
-H 'Content-Type: application/json'
Response
200 OK
Content-Type: application/json
[{
  "protocol": "HTTP",
  "sink": "https://endpoint.example.com/sink",
  "sinkCredential": {
    "credentialType": "PLAIN"
  },
  "types": [
    "string"
  ],
  "config": {
    "subscriptionDetail": {
      "device": {
        "phoneNumber": "+99012345678"
      },
      "area": {
        "areaType": "CIRCLE",
        "center": {
          "latitude": "48.80",
          "longitude": "2.259"
        },
        "radius": 2000
      }
    },
    "subscriptionExpireTime": "2023-01-17T13:18:23.682Z",
    "subscriptionMaxEvents": 5,
    "initialEvent": true
  },
  "id": "1119920371",
  "startsAt": "2024-07-11T19:08:47.612Z",
  "expiresAt": "2024-07-11T19:08:47.612Z",
  "status": "ACTIVE"
]

retrieve one geofencing subscription from its id

The subscription is retrieved only if it exists a subscription with this id for same client than the one requesting this GET operation.

In the response, a subscription is provided. The complete representation of the subscription resource is provided (same structure as POST response)

Request
curl -X GET "https://api.orange.com/camara/playground/api/geofencing/v0.3/subscriptions/{subscriptionsId}"
-H "Authorization: Bearer {your access token}"
-H "Cache-Control: no-cache"  
-H 'accept: application/json'
-H 'Content-Type: application/json'
Response

The complete representation of the subscription resource is provided (same structure that POST response)

delete one geofencing subscription

The subscription is deleted only if it exists a subscription with this id for same client than the one requesting this DELETE operation.

Request
curl -X DELETE "https://api.orange.com/camara/playground/api/geofencing/v0.3/subscriptions/{subscriptionsId}"
-H "Authorization: Bearer {your access token}"
-H "Cache-Control: no-cache"  
-H 'accept: application/json'
-H 'Content-Type: application/json'
Response
204 Event subscription deleted

Most frequent errors

If invalid input are provided in POST /subscriptions, in particular for the device identifier, a 400 error is triggered.

HTTP/1.1 400 Invalid input
Content-Type: application/json
{
  "code": "INVALID_ARGUMENT",
  "status": 400,
  "message": "Invalid input"
}

If the consumer request for a non existing subscription in GET /subscriptions/{subscriptionsId}, a 404 error is sent.

HTTP/1.1 404 Not found
Content-Type: application/json
{
  "status": 404,
  "code": "NOT_FOUND",
  "message": "The specified resource is not found"
}

If the subscription service is down, a 503 error is sent.

HTTP/1.1 503 Service unavailable
Content-Type: application/json
{
  "code": "UNAVAILABLE",
  "status": 503,
  "message": "Service unavailable"
}

There are some cases where your client application will no longer gain access to API resources, and get an error back.

Please check the following points:

  • Here, you attempt to use an expired or revoked access_token and you get an invalid token error. You will have to request a new access_token. As an example:
HTTP/1.1 401 Unauthorized
Content-Type: application/json
{
  "code": "UNAUTHENTICATED",
  "status": 401,
  "message": "Authorization failed: ..."
}
  • Here, you removed your subscription to the API so that the capability to generate an access_token is not allowed anymore. As an example:
HTTP/1.1 403 Forbidden
Content-Type: application/json
{
  "code": "PERMISSION_DENIED",
  "status": 403,
  "message": "Operation not allowed: ..."
}

Notification

Notifications will be received at consumer side, on the URL provided in the subscriptions.notificationUrl field in the subscription request (see above).

The API contains also the Notification definition in the callbacks part. The CAMARA subscription model is detailed in the CAMARA API design guideline document and follows CloudEvents specification.

Following event types are managed for this API:

  • org.camaraproject.geofencing.v0.area-entered - Event triggered when the device enters the given area

  • org.camaraproject.geofencing.v0.area-left - Event triggered when the device leaves the given area

Note: Additionally to these list, org.camaraproject.geofencing.v0.subscription-ends notification type is sent when the subscription ends. This notification does not require dedicated subscription. It is used when the subscription expire time (required by the requester) has been reached or if the API server has to stop sending notification prematurely.

Notification structure:

Following table describes the notification structure:

NameDescriptionTypeMandatory
idIdentifier of this event, that must be unique in the source context.stringYes
sourceIdentifies the context in which an event happened in the specific Provider Implementation.stringYes
typeIdentifies the type of the event:
-area-entered: Event triggered when the device enters the given area.
-area-left: Event triggered when the device leaves the given area.
-subscription-ends: Event triggered when the subscription ends
stringYes
specversionVersion of the specification to which this event conforms (always 1.0 in our case)stringYes
datacontenttypemedia-type that describes the event payload encoding, (always "application/json" in our case)stringNo
timeTimestamp when the occurrence happened.string - datetimeYes
dataData structure specific for each event type - see belowobjectYes
data for area-entered and area-left notification

The subscription area-entered or area-left notification data structure is the following:

NameDescriptionTypeMandatory
subscriptionIdIdentifier of subscriptionstringYes
deviceAn object with four fields, each of them make possible to pass device identifier in different format: networkAccessIdentifier, phoneNumber, ipv4Address and ipv6AddressSee above information on deviceYes
areaUsed to define the geographical area to be monitored.See above information on areaYes

Example of notification received:

HTTP/1.1 403 Forbidden
Content-Type: application/json
{
  "id": "6a11dad7-64b3-4f12-a28f-8a24411fe8e0",
  "source": "com.orange.camara.geofencing",
  "type": "org.camaraproject.geofencing.v0.area-entered",
  "specversion": "1.0",
  "datacontenttype": "application/json",
  "data": {
    "device": {
      "phoneNumber": "+99012345678"
    },
    "area": {
      "areaType": "CIRCLE",
      "center": {
        "latitude": 48.8,
        "longitude": 2.29
      },
      "radius": 2000
    },
    "subscriptionId": "5c9b3fa2-6d65-4768-ba52-a7281a525789"
  },
  "time": "2024-01-16T15:37:04.052088556Z"
}
data for area-entered and subscription_ends notification

The subscription ends notification data structure is the following:

NameDescriptionTypeMandatory
subscriptionIdIdentifier of subscriptionstringYes
deviceAn object with four fields, each of them make possible to pass device identifier in different format: networkAccessIdentifier, phoneNumber, ipv4Address and ipv6AddressSee above information on deviceYes
areaUsed to define the geographical area to be monitored.See above information on areaYes
terminationReasonTermination reasonstringYes

Example of notification received:

HTTP/1.1 403 Forbidden
Content-Type: application/json
{
    "id": "9f625ec0-f8d6-4ef2-a1ee-62a0424b4cc9",
    "source": "com.orange.camara.geofencing",
    "type": "org.camaraproject.geofencing.v0.subscription-ends",
    "specversion": "1.0",
    "datacontenttype": "application/json",
    "data": {
        "device": {
            "phoneNumber": "+99012345678"
        },
        "terminationReason": "SUBSCRIPTION_EXPIRED",
        "area": {
            "areaType": "CIRCLE",
            "center": {
                "latitude": 48.8,
                "longitude": 2.29
            },
            "radius": 2000
        },
        "subscriptionId": "19fbaf8d-0b76-4fde-a8d1-5991613e2ab1"
    },
    "time": "2024-01-16T15:26:29.388137893Z"
}

Looking for support ?

Facing technical issue when using this API ? please contact us

Go up

History of document

Version of the documentmodification datedescription of modifications
1.031/1/2024initialization by Orange CAMARA APIs team
1.117/4/2024Fixed simulator url
2.011/7/2024Aligned model with Cloud Events
2.120/8/2024Indicate that the prefix '+' is mandatory for the phoneNumber

Go up