Add Geofence
Contents
Please see the Sites feature in our Places API if you are looking for predefined geofences around warehouses, distribution centers, and many other important trucking facilities in North America.
This API allows you to create a geofence inside an existing geofence set.
POST /Geofence
Request Element
The Add Geofence operation requires JSON format data in the Post body.
Element | Definition | Required |
---|---|---|
SetId
| The Id of the set you are adding this geofence to. | Y |
Name
| The name of your geofence. | Y |
Label
| The optional label of your geofence. Max length is 255. | N |
ShapeType
| The shape of this geofence. 1 = circle 5 = polygon | Y |
Radius
| The radius in miles for a circular geofence. | Y - if defining a circle geofence |
ShapePoints
| An array of latitude and longitude coordinates that represent the border of the fence. The first and last points in the array must match. For circle geofences, use a single point as the center of the geofence. | Y |
StartTime
| The date/time indicating the beginning of a time window during which this geofence will be active. The time should be formatted according to the ISO 8601 Standard (YYYY-MM-DDTHH:MM:SSZ) | N |
EndTime
| The date/time indicating the end of a time window during which this geofence will be active. The time should be formatted according to the ISO 8601 Standard (YYYY-MM-DDTHH:MM:SSZ) | N |
Sample JSON Post Body
{
"SetId": 1013,
"Name": "myFence",
"Label": "my label",
"ShapeType": 5,
"ShapePoints": [
[-75.152955714212, 39.204307443124],
[-75.129804285788, 39.204307443124],
[-75.129804285788, 39.18629254291],
[-75.152955714212, 39.18629254291],
[-75.152955714212, 39.204307443124]
],
"StartTime": "2017-01-06T14:59:36-04:00",
"EndTime": "2018-01-06T14:59:36-04:00"
}
Response
The return from this operation is the ID of your newly created geofence.
1013
Errors
Data Element | Description | Data Type | Value/Example |
---|---|---|---|
Type
| Indicates whether the error is an exception or warning |
Enum | Warning Exception |
Code
| Error code |
Enum | Please refer to Appendix for complete list |
LegacyErrorCode
| The legacy error code with is an integer valued code that would have been returned in PC*Miler Web Services v25 and earlier. |
int | |
Description
| The detailed error description. |
string |