Locales API
The Locales API enumerates available Locales, create new Locales and modifies existing Locales.
| HTML Method | URI | Action |
|---|---|---|
| GET | /locales | Get a list of all available Locales |
| GET | /locales/{LOCALE_ID} | Get detailed information for a given Locale |
| POST | /locales | Create a new Locale |
| PUT | /locales/{LOCALE_ID} | Modify an existing Locale |
| DELETE | /locales/{LOCALE_ID} | Delete an existing Locale |
Get Available Locales
URI Parameters: None
HTML Method: GET
Example:
curl -H 'X-Api-Key: API_KEY' https://www.telemetry.net.au/api/v1/locales
Returns: If the call succeeds, returns a list of Locales in JSON format. The Locale information returned is a subset of the information returned by the “Get Locale Details” call below. The following example shows the current fields returned.
{
"localeCount":2,
"locales":
[
{
"id":100,
"name":"Locale 1",
},
{
"id":101,
"name":"Locale 2",
},
]
}
| Field | Description |
|---|---|
| id | Internal unique identifier for the Locale |
| name | Name of Locale |
Get Locale Details
URI Parameters: LOCALE_ID
HTML Method: GET
Example:
curl -H 'X-Api-Key: API_KEY' https://www.telemetry.net.au/api/v1/locales/100
Returns: If the call succeeds, returns detailed information about the Locale in JSON format. The following example shows the current fields returned.
{
"id":100,
"name":"Locale 1",
"description":"",
"latitude":-18.337,
"longitude":130.638,
"companyID":5,
"tag":""
}
| Field | Description |
|---|---|
| id | Internal unique identifier for the Locale |
| name | Name of Locale |
| description | Description of the Locale |
| latitude | GPS Coordinate of Locale |
| longitude | GPS Coordinate of Locale |
| companyID | Internal unique identifier for the Company this Locale belong to |
| tag | A Tag string which can be used to identify the Locale |
Create New Locale
URI Parameters: None
HTML Method: POST
POST Data: JSON format specifying the parameters for the new Locale. See the table below for allowed parameters. The “id” field is ignored if present, a new unique ID will be assigned to the newly created Locale.
Valid Fields:
| Field | Description |
|---|---|
| name | Name of Locale [Required] |
| description | Description of the Locale |
| latitude | Location of Locale if known |
| longitude | Location of Locale if known |
| companyID | The CompanyID to use if the API Key has rights to multiple companies |
| tag | Tag to assign to the new Locale |
Example:
curl -X POST -H "Content-Type: application/json" -H 'X-Api-Key: API_KEY' --data '{"name":"Locale 3", "latitude":-27.215191,"longitude":153.094323}' https://www.telemetry.net.au/api/v1/locales
Returns: If the call succeeds, returns detailed information about the Locale created in JSON format.
Note
API Key must have write access
Modify Existing Locale
URI Parameters: LOCALE_ID
HTML Method: PUT
PUT Data: JSON format specifying the parameters to change for the specified Locale. Allowable parameters are identical the the “Create New Locale” call above.
Example:
curl -X PUT -H "Content-Type: application/json" -H 'X-Api-Key: API_KEY' --data '{"name":"Locale 4"}' https://www.telemetry.net.au/api/v1/locales/100
Returns: If the call succeeds, returns detailed information about the Locale in JSON format.
Note
API Key must have write access
Delete Locale
URI Parameters: LOCALE_ID
HTML Method: DELETE
Example:
curl -X DELETE -H 'X-Api-Key: API_KEY' https://www.telemetry.net.au/api/v1/locales/103
Returns: If the call succeeds, returns detailed information about the Locale deleted in JSON format.
Warning
- This cannot be undone!!
- Any Sites in the Locale will be moved to the root of the Company.
- The Locale will be removed from any parent groups.
Note
API Key must have write access