Skip to content

Updating a GeoPoint

This API performs the "remove and save" operation on a geo point object in the backend geo location storage. For partial updates use the PATCH request which updates only the parameters present in the request.

Method

complete replacement (remove and re-save) - PUT

partial update only for the parameters present in the request - PATCH

URL

https://api.backendless.com/<application-id>/<REST-api-key>/geo/points/<geoPointObjectId>

where:

Argument                Description
<application id> ID of the application which can be obtained from the Manage > App Settings screen of the Backendless Console
<REST-api-key> REST API key of your application. You can get the value from the Manage > App Settings section of the Backendless Console.
<geoPointObjectId> objectId assigned to the geo point which should be modified.

Request Body

{  
  "latitude": <latitude>,  
  "longitude": <longitude>,  
  "categories": <categories>  
  "metadata": <metadata>  
}

where:

Argument                Description
<latitude> a numeric value. Latitude to update to.
<longitude> a numeric value. Longitude to update to.
<categories> optional parameter. A JSON array of categories to move the point to. If a category does not exist at the time when a point is added, Backendless creates the category and moves the point to it. If the parameter is not present in the request, the point is added to the "Default" category.
<metadata> optional parameter. A JSON object representing the metadata associated with the geo point.

The semantics of the arguments is different between the PUT and PATCH requests:

PUT (remove and re-save)

  • latitude and longitude are required
  • If categories is not present, the geo point is removed from the current category and moved to "Default"
  • If categories is present, the geo point is removed from the current category and moved to the specified category
  • If metadata is not present, the current metadata is removed.
  • If metadata is present, it replaces the current metadata

PATCH (partial update)

  • All parameters are optional, but at least one must be present.
  • latitude and longitude are not required.
  • If latitude or longitude are present, the new values replace the existing ones.
  • If categories is present, the geo point is moved to the specified categories (with coordinates and metadata).
  • If categories is not present, the geo point stays in the current category.
  • If metadata is not present, the geo point keeps the current metadata.
  • If metadata is present and not an empty object, the new metadata replaces the existing one.
  • If metadata is present and it is an empty object, the existing metadata is removed.

Request headers

Content-Type: application/json  
user-token: optional value obtained as a result of the login operation.

where:

Argument                Description
Content-Type Must be set to application/json. This header is mandatory.
user-token Optional header. Contains a value returned by Backendless in a preceding user Login API call. If user-token is set in the request, the currently logged in user will be assigned to the ownerId property of the user object which is being saved.  Additionally, the operation will be executed with the security policy associated currently logged in user. This means all permissions associated with the user and the roles assigned to the user will be enforced by Backendless.

Sample PUT Request

curl -X PUT -H Content-Type:application/json \  
-d "{\"longitude\":65.32, \"latitude\":-15.22, \  
     \"categories\":[\"Cafe\"], \"metadata\":{\"foo\":\"bar\"} }" \  
-v "http://api.backendless.com/XXXX-XXXX-XXXX/ZZZZ-ZZZZ-ZZZZ/geo/points/YOUR-GEOPOINT-OBJECTID"

Sample PATCH Request

curl -X PATCH -d "{\"latitude\":10.2, \"longitude\":20.3}" \  
-v "https://api.backendless.com/XXXXX-XXXXX-XXXX/ZZZZ-ZZZZZ-ZZZZ/geo/points/YOUR-GEOPOINT-OBJECTID"

If an error occurs, the response is formatted as described in the Error Handling section.