Skip to content

Adding a Geo Category

This API creates a geo category. A geo category is a logical grouping of geo points. Category name may contain the following literals: a-z, A-Z, numbers 0-9 and the underscore (_ ) character. The name must start with a literal. Category names can be inspected using Backendless Console (see the image below) or using the API call retrieving a list of categories.

Adding Categories in Console

Backendless Console supports adding a category via the graphical interface. To create a category:

  1. Login to Backendless Console and select your app/backend.
  2. Click the Geolocation icon in the menu on the left.
  3. Use the "plus" icon located above the section containing the list of categories:
    create-new-geo-cat

  4. Enter the category name in the popup and click "Save".


Adding Categories with the API

Method

PUT

URL

https://api.backendless.com/<application-id>/<REST-api-key>/geo/categories/<categoryName> 

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.
<categoryName> name of the category to create.

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.

Response Body

A JSON object representing the added category:

{  
  "objectId": "<categoryId>",  
  "size": "0",  
  "name": "<categoryName>"  
}

where:

Argument                Description
<categoryId> object ID assigned to the category by the server
<categoryName> name of the category created with the request.

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

Example

curl -X PUT \  
-v http://api.backendless.com/XXXX-XXXX-XXXX/ZZZZ-ZZZZ-ZZZZ/geo/categories/foobarcategory