GeoFence
The following series of services are part of the Geofence API. Click here for a high-level overview of Geofence.
Fence Operations
This segment of services is used to create, review and modify your geofences.
List
-
list.{format}
- http://sprintdevelopersandbox.com/developerSandbox/resources/v1/geofence/list.{format}?{params}
This service is used to return all geofences associated with a user.
-
Authentication
- This method requires a generated MD5 signature.
-
Arguments
-
- key Your API Key, click here here to view.
- timestamp The current time of the request: [YYYY]-[MM]-[DD]T[HH]:[MM]:[SS][ZZZ]
- sig: The MD5 Digest value of the parameters of the geofence service and your secret. The directions for generating this signature can be found here.
[HH] refers to a zero-padded hour between 00 and 23 (where 00 is used to notate midnight at the start of a calendar day).
-
Http Method
- Get
-
Response
-
- fenceId ID of the fence associated with the user.
- status Whether or not the fence is currently active (monitoring) or inactive (not monitoring).
- startEndTime The times between which the fence monitors (if active), i.e. 915-1430, times are military.
- days Days the fence monitors (if active), note: H=Thurs, A=Sat.
- lastMonitor Date\Time of the last check on this fence.
- latitude Center latitude on which the fence is based.
- longitude Center longitude on which the fence is based.
- dimensions Dimensions of the fence (currently “radius” is v1 of geofence).
-
Example Request
- Get
-
http://sprintdevelopersandbox.com/developerSandbox/resources/v1/geofence/list?key=123abckey×tamp=2010-03-05T10:12:00CST&sig=123abcdef456
- Example Response
-
110(Inactive, 900-1700, MTWHF, NEVER, 38.9178, -94.6598, 50), 427(Active, 930-1115, SA, NEVER, 38.9178, -94.6598, 500)
Add
-
add.{format}
- http://sprintdevelopersandbox.com/developerSandbox/resources/v1/geofence/add.{format}?{params}
This service is used to add a fence.
-
Authentication
- This method requires a generated MD5 signature.
-
Arguments
-
- key: Your API Key, click here to view.
- name: The name of the fence.
- strtTime: Earliest time to start monitoring the fence, format [HH][MM]
- endTime: Latest time to monitor the fence, format [HH][MM]
- lat: Center latitude on which to base the fence.
- long: Center longitude on which to base the fence.
- dim: Dimensions of the fence (for v1 of geofence, this is the radius).
- interval: The interval at which the fence should be checked;
note: only increments of 5 min are allowed; i.e. 5, 15, 25, etc.
- days Days on which the fence should be monitored, as a String with a single representing each day
- notifyEvent: Whether the fence should notify on “in”, “out” or “both” (excluding this param will default to “both”).
- timestamp: The current time of the request: [YYYY]-[MM]-[DD]T[HH]:[MM]:[SS][ZZZ]
- sig: The MD5 Digest value of the parameters of the geofence service and your secret. The directions for generating this signature can be found here.
note: [HH] refers to a zero-padded hour between 00 and 23 (where 00 is used to notate midnight at the start of a calendar day).
note: [HH] refers to a zero-padded hour between 00 and 23 (where 00 is used to notate midnight at the start of a calendar day).
note: H=Thurs, A=Sat; i.e. SMTWHFA.
note: [HH] refers to a zero-padded hour between 00 and 23 (where 00 is used to notate midnight at the start of a calendar day).
-
Http Method
- Get
-
Response:
-
- message Success message if recipient was added or an error message.
- Example Request: Get http://sprintdevelopersandbox.com/developerSandbox/resources/v1/geofence/add?key=123abckey& name=My%20Fence&strtTime=900&endTime=1700&lat=38.917806&long=-94.659787&dim=50&interval=15&days=MTWHF×tamp=2010-03-05T10:12:00CST&sig=123abcdef456
-
Example Response
- FENCE_ADDED
Activate
-
activate.{format}
- http://sprintdevelopersandbox.com/developerSandbox/resources/v1/geofence/activate.{format}?{params}
This service is used to activate an existing fence.
-
Authentication
- This method requires a generated MD5 signature.
-
Arguments
-
- key: Your API Key, click here to view.
- fenceId: The ID of the fence to activate.
- timestamp: The current time of the request: [YYYY]-[MM]-[DD]T[HH]:[MM]:[SS][ZZZ]
- sig: The MD5 Digest value of the parameters of the geofence service and your secret. The directions for generating this signature can be found here.
[HH] refers to a zero-padded hour between 00 and 23 (where 00 is used to notate midnight at the start of a calendar day).
-
Http Method
- Get
-
Response
- message: Success message if fence was activated or an error message.
- Example Request
- Get
-
http://sprintdevelopersandbox.com/developerSandbox/resources/v1/geofence/activate?key=123abckey&fenceId=110×tamp=2010-03-05T10:12:00CST&sig=123abcdef456
- Example Response
-
FENCE_ACTIVATED
Deactivate
-
deactivate.{format}
- http://sprintdevelopersandbox.com/developerSandbox/resources/v1/geofence/deactivate.{format}?{params}
This service is used to deactivate an existing fence. -
Authentication
- This method requires a generated MD5 signature.
-
Arguments
-
- key: Your API Key, click here to view.
- fenceId: The ID of the fence to activate.
- timestamp: The current time of the request: [YYYY]-[MM]-[DD]T[HH]:[MM]:[SS][ZZZ]
- sig: The MD5 Digest value of the parameters of the geofence service and your secret. The directions for generating this signature can be found here.
[HH] refers to a zero-padded hour between 00 and 23 (where 00 is used to notate midnight at the start of a calendar day).
-
Http Method
- Get
-
Response
- message Success message if fence was deactivated or an error message.
-
Example Request
- Get:
-
http://sprintdevelopersandbox.com/developerSandbox/resources/v1/geofence/deactivate?key=123abckey&fenceId=110×tamp=2010-03-05T10:12:00CST&sig=123abcdef456
- Example Response
-
FENCE_DEACTIVATED
Device Operations
The services following are used to maintain devices being tracked in relation to a specific geofence.
List
-
listDevices.{format}
- http://sprintdevelopersandbox.com/developerSandbox/resources/v1/geofence/listDevices.{format}?{params}
This service is used to return all devices associated with a geofence. -
Authentication
- This method requires a generated MD5 signature.
-
Arguments
-
- key: Your API Key, click here to view.
- fenceId: The ID of the fence whose recipients you want listed.
- timestamp: The current time of the request: [YYYY]-[MM]-[DD]T[HH]:[MM]:[SS][ZZZ]
- sig: The MD5 Digest value of the parameters of the geofence service and your secret. The directions for generating this signature can be found here.
[HH] refers to a zero-padded hour between 00 and 23 (where 00 is used to notate midnight at the start of a calendar day).
-
Http Method
- Get
-
Response
-
- deviceId ID of the device associated with the fence.
- mdn MDN of the fence device.
-
Example Request
- Get
-
http://sprintdevelopersandbox.com/developerSandbox/resources/v1/geofence/listDevices?key=123abckey&fenceId=110×tamp=2010-03-05T10:12:00CST&sig=123abcdef456
-
1(8165551111), 14(9135552121)
Add
-
addDevice.{format}
- http://sprintdevelopersandbox.com/developerSandbox/resources/v1/geofence/addDevice.{format}?{params} This service is used to add a device to a fence.
-
Authentication
- This method requires a generated MD5 signature.
-
Arguments
-
- key: Your API Key, click here to view.
- fenceId: The ID of the fence to add the device to.
- Mdn: MDN of the device.
- timestamp: The current time of the request: [YYYY]-[MM]-[DD]T[HH]:[MM]:[SS][ZZZ]
- sig: The MD5 Digest value of the parameters of the geofence service and your secret. The directions for generating this signature can be found here.
[HH] refers to a zero-padded hour between 00 and 23 (where 00 is used to notate midnight at the start of a calendar day).
-
Http Method
- Get
-
Response
- message Success message if device was added or an error message.
-
Example Request
- Get
-
http://sprintdevelopersandbox.com/developerSandbox/resources/v1/geofence/addDevice?key=123abckey&fenceId=110&mdn=9135552121×tamp=2010-03-05T10:12:00CST&sig=123abcdef456
- Example Response
-
DEVICE_ADDED
Delete
-
deleteDevice.{format}
- http://sprintdevelopersandbox.com/developerSandbox/resources/v1/geofence/deleteDevice.{format}?{params}
This service is used to delete an existing fence device. -
Authentication
- This method requires a generated MD5 signature.
-
Arguments
-
- key: Your API Key, click here to view.
- deviceId: The ID of the device to delete.
- timestamp: The current time of the request: [YYYY]-[MM]-[DD]T[HH]:[MM]:[SS][ZZZ] [HH] refers to a zero-padded hour between 00 and 23 (where 00 is used to notate midnight at the start of a calendar day).
- sig: The MD5 Digest value of the parameters of the geofence service and your secret. The directions for generating this signature can be found here.
-
Http Method
- Get
-
Response
- message Success message if device was deleted or an error message.
-
Example Request
- Get
-
http://sprintdevelopersandbox.com/developerSandbox/resources/v1/geofence/deleteDevice?key=123abckey&deviceId=217×tamp=2010-03-05T10:12:00CST&sig=123abcdef456
- Example Response
-
DEVICE_DELETED
Recipient Operations
Recipients of notifications for a particular geofence are managed with these services.
List
-
listRecipients.{format}
- http://sprintdevelopersandbox.com/developerSandbox/resources/v1/geofence/listRecipients.{format}?{params}
This service is used to return all recipients associated with a geofence. -
Authentication
- This method requires a generated MD5 signature.
-
Arguments
-
- key: Your API Key, click here to view.
- fenceId: The ID of the fence whose recipients you want listed.
- timestamp: The current time of the request: [YYYY]-[MM]-[DD]T[HH]:[MM]:[SS][ZZZ] [HH] refers to a zero-padded hour between 00 and 23 (where 00 is used to notate midnight at the start of a calendar day).
- sig: The MD5 Digest value of the parameters of the geofence service and your secret. The directions for generating this signature can be found here.
-
Http Method
- Get
-
Response
-
- recipientId: ID of the recipient associated with the fence.
- mdnURL: MDN or URL of the notification recipient.
-
Example Request
- Get
-
http://sprintdevelopersandbox.com/developerSandbox/resources/v1/geofence/listRecipients?key=123abckey&fenceId=110×tamp=2010-03-05T10:12:00CST&sig=123abcdef456
- Example Response
-
112(8165551111), 146(9135552121), 327(http://www.notifymyapp.com)
Add
addRecipient.{format}
This service is used to add a recipient (may be either an MDN or URL) to a fence.
Authentication
Arguments
- key: Your API Key, click here to view.
- fenceId: The ID of the fence to add the recipient to.
- mdn/URL: MDN or URL for the notification recipient.
- timestamp: The current time of the request: [YYYY]-[MM]-[DD]T[HH]:[MM]:[SS][ZZZ] [HH] refers to a zero-padded hour between 00 and 23 (where 00 is used to notate midnight at the start of a calendar day).
- sig: The MD5 Digest value of the parameters of the geofence service and your secret. The directions for generating this signature can be found here.
Http Method
Response
- message Success message if recipient was added or an error message.
Example Request
-
http://sprintdevelopersandbox.com/developerSandbox/resources/v1/geofence/addRecipient?key=123abckey&fenceId=110&mdnURL=9135552121×tamp=2010-03-05T10:12:00CST&sig=123abcdef456
-
RECIPIENT_ADDED
Delete
-
deleteRecipient.{format}
- http://sprintdevelopersandbox.com/developerSandbox/resources/v1/geofence/deleteRecipient.{format}?{params}
- This service is used to delete an existing fence notification recipient.
Authentication
- This method requires a generated MD5 signature.
-
Arguments
-
- key: Your API Key, click here to view.
- recipientId: The ID of the recipient to delete.
- timestamp: The current time of the request: [YYYY]-[MM]-[DD]T[HH]:[MM]:[SS][ZZZ] note: [HH] refers to a zero-padded hour between 00 and 23 (where 00 is used to notate midnight at the start of a calendar day).
- sig: The MD5 Digest value of the parameters of the geofence service and your secret. The directions for generating this signature can be found here.
-
Http Method
- Get
-
Response
- message Success message if recipient was deleted or an error message.
-
Example Request
- Get
-
http://sprintdevelopersandbox.com/developerSandbox/resources/v1/geofence/deleteRecipient?key=123abckey&recipientId=217×tamp=2010-03-05T10:12:00CST&sig=123abcdef456
- Example Response
-
RECIPIENT_DELETED
Perimeter Check
-
checkPerimeter.{format}
- http://sprintdevelopersandbox.com/developerSandbox/resources/v1/geofence/checkPerimeter.{format}?{params}
- This service is used to determine if a device is inside a defined area, or “fence.”
Authentication
- This method requires a generated MD5 signature.
-
Arguments
-
- mdn: The MDN of the device to be located.
- key: Your API Key, click here to view.
- lat: The latitude of the center of the geofence.
- long: The longitude of the center of the geofence.
- rad: The size of the fence in meters.
- timestamp: The current time of the request: [YYYY]-[MM]-[DD]T[HH]:[MM]:[SS][ZZZ] Note: [HH] refers to a zero-padded hour between 00 and 23 (where 00 is used to notate midnight at the start of a calendar day).
- sig: The MD5 Digest value of the parameters of the geofence service and your secret. The directions for generating this signature can be found here.
-
Http Method
- Get
-
Response
-
- mdn: The mdn of the device that was located.
- latReq: The requested latitude for the center of the fence.
- lonReq: The requested longitude for the center of the fence.
- radReq: The requested radius of the fence, in meters.
- latRes: The actual latitude of the requested device.
- lonRes: The actual longitude of the requested device.
- accuracy: The accuracy of the location fix for the device.
- status: The status of the request, meaning that if device is inside or outside of the fence.
- comment: Additional information pertaining to the fence, this is only displayed if there is an issue with one of your parameters, e.g. your radius is smaller than your accuracy.
-
Example Request
- Get
-
http://sprintdevelopersandbox.com/developerSandbox/resources/v1/geofence/checkPerimeter?key=123abckey&mdn=9135555151&lat=38.917806&long=-94.659787&rad=5×tamp=2010-03-05T10:12:00CST&sig=123abcdef456
- Example Response
-
9135555151,38.917806,-94.659787,5.0,38.914948,
-94.65723,0.0,OUTSIDE
Geofence Errors
-
Errors
-
- INVALID_LAT_LONG Latitude\Longitude is invalid.
- INVALID_COORDINATES Coordinates are invalid.
- INVALID_ACTION Action (i.e. checkPerimeter, add, addRecipient, etc) is invalid.
- INVALID_KEY Key is invalid.
- INVALID_FENCE Fence referenced is invalid.
- INVALID_FENCE_ID Fence ID is invalid.
- INVALID_RECIPIENT Recipient referenced isn’t valid.
- INVALID_TIME Time entered for fence isn’t valid.
- INVALID_LATITUDE Latitude is not valid.
- INVALID_LONGITUDE Um, what do you think this means?
- INVALID_RADIUS Radius isn’t valid.
- EXPIRED_KEY The API key has expired.
- INVALID_MDN Not a valid 10 digit number.
- LOCATION_ERROR A service exception occurred on the server side.
- EXHAUSTED_DIPS You have exceeded your transaction limit.
- GENERAL_FAILURE We don’t really know what happened.
