Updating a GeoPoint

Updating a GeoPoint

Top  Previous  Next

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:

PUT- complete replacement (remove and re-save)

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

 

URL:

There are two request formats: (1) passing parameters in the URL; (2) passing parameters in the request body (as JSON).

 

Parameters in the URL:

https://api.backendless.com/<version>/geo/points/<geoPointObjectId>?lat=<latitude>&lon=<longitude>&categories=<categories>&metadata=<metadata>

 

Parameters in the request body:

URL:

https://api.backendless.com/<version>/geo/points/<geoPointObjectId>

Body:

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

where:

<version>- name of the application's version. Application versions can be managed using Backendless Console. Login to the console, select an application, click Manage, then Versioning. Backendless automatically creates version "v1" for any new application.
<geoPointObjectId>- objectId assigned to the geo point which should be modified.
<latitude>- latitude of the point to update.
<longitude>- longitude of the point to update.
<categories>- list of categories the point is placed into separated by comma.
<metadata>- metadata associated with the geo point. Must be expressed in as a JSON object. For the requests where all the parameters are in the URL, this  value must be URL-encoded. For example, { "foo":"bar" } will be URL-encoded as:  %20%7B%20%22foo%22%3A%22bar%22%20%7D. Accepted values for this parameter are: String, Number (integer and double), and Data Service objects. Date values must be represented as number in the Unix timestamp format (number of milliseconds since January 1, 1970 at UTC). Learn more about using date in search queries for category, radius, or rectangular area search.

 

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:

application-id: app-id-value
secret-key: secret-key-value
application-type: REST
Content-type: application/json // ONLY when there is a JSON body for the request!

where:

application-id- the ID of your application generated upon its creation. You can find this header in the Manage > App Settings section of the Backendless Console. This header is mandatory. Please refer to the Setup section for information on how to obtain the values for the header.
secret-key - the key of your application generated upon its creation. You can find this header in the Manage > App Settings section of the Backendless Console. This header is mandatory. Please refer to the Setup section for information on how to obtain the values for the header.
application-type- the static value, should be set to REST. This header is mandatory.
Content-type- this header is required only if the request contain any payload in the body.

 

Sample PUT Request (parameters in the URL):

curl -H "application-id: YOUR-APP-ID" -H "application-type: REST" -H "secret-key: YOUR-REST-KEY" -X PUT -v "https://api.backendless.com/v1/geo/points/YOUR-GEOPOINT-OBJECTID?lat=10.1&lon=30.2"

Sample PATCH Request (parameters in the URL):

curl -H "application-id: YOUR-APP-ID" -H "application-type: REST" -H "secret-key: YOUR-REST-KEY" -X PATCH -v "https://api.backendless.com/v1/geo/points/YOUR-GEOPOINT-OBJECTID?lat=10.1&lon=3"

Sample PATCH Request (parameters in the body):

curl -H "application-id: YOUR-APP-ID" -H "application-type: REST" -H "secret-key: YOUR-REST-KEY" -X PATCH -d "{\"latitude\":10.2, \"longitude\":20.3}" -v "https://api.backendless.com/v1/geo/points/YOUR-GEOPOINT-OBJECTID"

 

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

 

 


Please let us know how we can improve the documentation by leaving a comment. All technical questions should be posted to the Backendless Support forum. We do not respond to the technical questions on the documentation pages.: