Step 4. Complete setup: sync your geofences.

In Steps 1-4, you set up TMS integration by synchronizing TMS entities. In this step, complete the setup by using a GETcall, a POST call, and then a DELETE call to sync your geofences between the two systems.

A geofence object represents a virtual perimeter for a real-world geographic area. The object consists of a set of latitude and longitude points that form a closed polygon.

We’ll use this API to retrieve all geofences, and then sync the two systems by creating a new geofence, and also deleting an outdated geofence.

List Geofences: GET https://api.keeptruckin.com/v1/geofences

The GET call retrieves a list of all your company’s geofences in the KeepTruckin system. The list includes each geofence ID, name, category, status (‘active’ or ‘deactivated’), address, and location points.

Create a New Geofence: POST https://api.keeptruckin.com/v1/geofences

Perhaps you have found a recent geofence in your system that has not yet been synchronized in the KeepTruckin system. The POST call creates a new geofence in KeepTruckin’s system. Provide the geofence’s name, category, and an array of location_points; optionally provide its status. While category is a required field, ‘Uncategorized’ is an accepted value. The array of location_points must form a closed polygon and is expected as an array of hashes. The status value defaults to ‘active’ if none is provided.

Delete a Geofence: DELETE https://api.keeptruckin.com/v1/geofences/:id

Now let’s say you have also found a recently invalid geofence in your system, which you also want to remove from KeepTruckin’s system. The DELETE call requires only the geofence’s ID.

📘

Learn more

Read our reference documentation about the Geofences object, the GET call, the POST call, and the DELETE call for details.

You’re done with the setup portion of our workflow! In the next handful of steps, you will use the TMS core functionality for your day-to-day operations.

Language
Authentication
Header
Click Try It! to start a request and see the response here!