Skip to main content

Update a geofence

PUT 

/api/v1/geofences/:geofenceId

Update (modify) a geofence by its internal ID. This will update the geofence with the new data provided in the request body.

ETag Requirement

This endpoint requires the If-Match header with a valid ETag value to prevent lost updates due to concurrent modifications. Get the current ETag by retrieving the geofence with a GET request first.

As with all PUT modifications, you must include the If-Match header with the current ETag value of the user record or the request will fail with a "412 Precondition Failed" status code. The ETag value can be obtained by retrieving the item with a GET request and examining the ETag header in the response.

Updating Geofence Assignments

To modify geofence assignments, include a complete assignments array in the request body. The provided assignments will replace all existing assignments:

  • To add new assignments: Include existing assignments plus new ones
  • To remove assignments: Omit them from the assignments array
  • To clear all assignments: Send an empty array: "assignments": []
  • To leave assignments unchanged: Omit the assignments field entirely
Required abilities

This operation requires the Geofence - Manage ability, or Authority - Administrator.

Name Uniqueness

The pname field must remain unique across all geofences. Attempting to change a geofence name to match another existing geofence will result in a 409 Conflict error.

Request

Responses

Successfully updated the geofence. The response includes the complete updated geofence object.

Note: Unlike many REST APIs that return 204 No Content for PUT operations, this endpoint returns 200 OK with the complete updated geofence object in the response body.

Response Headers
    Location

    The URL of the updated or modified object.