Create a geofencing subscription for a device
POST/devicelocation/subscriptions
Create a subscription for a device to receive notifications when the device enters or exits a specified area.
Create a geofencing subscription for a device
curl https://api.example.com/camara/devicelocation/subscriptions \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $CAMARA_BEARER_TOKEN" \
-d '{
"config": {
"initialEvent": true,
"subscriptionExpireTime": "2024-03-22T05:40:58.469Z",
"subscriptionMaxEvents": 10,
"subscriptionDetail": {
"area": {
"areaType": "CIRCLE"
},
"device": {
"phoneNumber": "+12345678912"
}
}
},
"protocol": "HTTP",
"sink": "https://notificationSendServer12.supertelco.com",
"types": [
"org.camaraproject.geofencing-subscriptions.v0.area-entered"
]
}'{
"id": "1119920371",
"config": {
"initialEvent": true,
"subscriptionExpireTime": "2023-01-17T13:18:23.682Z",
"subscriptionMaxEvents": 5,
"subscriptionDetail": {
"area": {
"areaType": "CIRCLE"
},
"device": {
"ipv4Address": {
"privateAddress": "84.125.93.10",
"publicAddress": "84.125.93.10",
"publicPort": 59765
},
"ipv6Address": "2001:db8:85a3:8d3:1319:8a2e:370:7344",
"networkAccessIdentifier": "123456789@domain.com",
"phoneNumber": "+123456789"
}
}
},
"protocol": "HTTP",
"sink": "https://endpoint.example.com/sink",
"startsAt": "2023-07-03T12:27:08.312Z",
"types": [
"org.camaraproject.geofencing-subscriptions.v0.area-entered"
],
"expiresAt": "2023-07-03T12:27:08.312Z",
"status": "ACTIVATION_REQUESTED"
}{
"status": 400,
"code": "INVALID_ARGUMENT",
"message": "Client specified an invalid argument, request body or query param."
}{
"status": 400,
"code": "INVALID_PROTOCOL",
"message": "Only HTTP is supported."
}{
"status": 400,
"code": "INVALID_CREDENTIAL",
"message": "Only Access token is supported."
}{
"status": 400,
"code": "INVALID_TOKEN",
"message": "Only bearer token is supported."
}{
"status": 400,
"code": "INVALID_SINK",
"message": "sink not valid for the specified protocol"
}{
"status": 401,
"code": "UNAUTHENTICATED",
"message": "Request not authenticated due to missing, invalid, or expired credentials. A new authentication is required."
}{
"status": 403,
"code": "PERMISSION_DENIED",
"message": "Client does not have sufficient permissions to perform this action."
}{
"status": 422,
"code": "SERVICE_NOT_APPLICABLE",
"message": "The service is not available for the provided identifier."
}{
"status": 422,
"code": "MISSING_IDENTIFIER",
"message": "The device cannot be identified."
}{
"status": 422,
"code": "MULTIEVENT_SUBSCRIPTION_NOT_SUPPORTED",
"message": "Multi event types subscription not managed."
}{
"status": 422,
"code": "UNNECESSARY_IDENTIFIER",
"message": "The device is already identified by the access token."
}{
"status": 422,
"code": "UNSUPPORTED_IDENTIFIER",
"message": "The identifier provided is not supported."
}{
"status": 422,
"code": "GEOFENCING_SUBSCRIPTIONS.AREA_NOT_COVERED",
"message": "Unable to cover the requested area"
}{
"status": 422,
"code": "GEOFENCING_SUBSCRIPTIONS.INVALID_AREA",
"message": "The requested area is too small"
}{
"status": 429,
"code": "QUOTA_EXCEEDED",
"message": "Out of resource quota."
}{
"status": 429,
"code": "TOO_MANY_REQUESTS",
"message": "Rate limit reached."
}Returns Examples
{
"id": "1119920371",
"config": {
"initialEvent": true,
"subscriptionExpireTime": "2023-01-17T13:18:23.682Z",
"subscriptionMaxEvents": 5,
"subscriptionDetail": {
"area": {
"areaType": "CIRCLE"
},
"device": {
"ipv4Address": {
"privateAddress": "84.125.93.10",
"publicAddress": "84.125.93.10",
"publicPort": 59765
},
"ipv6Address": "2001:db8:85a3:8d3:1319:8a2e:370:7344",
"networkAccessIdentifier": "123456789@domain.com",
"phoneNumber": "+123456789"
}
}
},
"protocol": "HTTP",
"sink": "https://endpoint.example.com/sink",
"startsAt": "2023-07-03T12:27:08.312Z",
"types": [
"org.camaraproject.geofencing-subscriptions.v0.area-entered"
],
"expiresAt": "2023-07-03T12:27:08.312Z",
"status": "ACTIVATION_REQUESTED"
}{
"status": 400,
"code": "INVALID_ARGUMENT",
"message": "Client specified an invalid argument, request body or query param."
}{
"status": 400,
"code": "INVALID_PROTOCOL",
"message": "Only HTTP is supported."
}{
"status": 400,
"code": "INVALID_CREDENTIAL",
"message": "Only Access token is supported."
}{
"status": 400,
"code": "INVALID_TOKEN",
"message": "Only bearer token is supported."
}{
"status": 400,
"code": "INVALID_SINK",
"message": "sink not valid for the specified protocol"
}{
"status": 401,
"code": "UNAUTHENTICATED",
"message": "Request not authenticated due to missing, invalid, or expired credentials. A new authentication is required."
}{
"status": 403,
"code": "PERMISSION_DENIED",
"message": "Client does not have sufficient permissions to perform this action."
}{
"status": 422,
"code": "SERVICE_NOT_APPLICABLE",
"message": "The service is not available for the provided identifier."
}{
"status": 422,
"code": "MISSING_IDENTIFIER",
"message": "The device cannot be identified."
}{
"status": 422,
"code": "MULTIEVENT_SUBSCRIPTION_NOT_SUPPORTED",
"message": "Multi event types subscription not managed."
}{
"status": 422,
"code": "UNNECESSARY_IDENTIFIER",
"message": "The device is already identified by the access token."
}{
"status": 422,
"code": "UNSUPPORTED_IDENTIFIER",
"message": "The identifier provided is not supported."
}{
"status": 422,
"code": "GEOFENCING_SUBSCRIPTIONS.AREA_NOT_COVERED",
"message": "Unable to cover the requested area"
}{
"status": 422,
"code": "GEOFENCING_SUBSCRIPTIONS.INVALID_AREA",
"message": "The requested area is too small"
}{
"status": 429,
"code": "QUOTA_EXCEEDED",
"message": "Out of resource quota."
}{
"status": 429,
"code": "TOO_MANY_REQUESTS",
"message": "Rate limit reached."
}