Create Location
Use this API endpoint to create a new location for your organisation, enabling you to register and manage additional locations. By specifying details about the new location, you can ensure accurate representation and easy access to information across platforms and for users.
Syntax: see 'CCall Structure
Type = 'POST'
| 'https://connect.cambrionix.com/api/locations/v1/location' \ |
In the data section of the request, include the location fields you wish to add, formatted as shown below.
|
{ "name": "location-name", "description": "location-description", "organization": { "id": "organisation-id" }, "address": { "components": [ { "name": { "long": "long-name", "short": "short-name" }, "types": [ "component-type" ] } ], "location": { "latitude": "latitude", "longitude": "longitude" }, "formatted": "formatted-address" }, "viewport": { "northeast": { "latitude": "latitude", "longitude": "longitude" }, "southwest": { "latitude": "latitude", "longitude": "longitude" } } }, "type": "address-type", ], } |
| Output | Description |
|---|---|
| location-name | This is the user defined name of the location |
| organisation-id | This is the unique id of the organisation |
| long-name | The full name of the component |
| short-name | The shorthand version of the name of the component |
| component-type | The address component type see Address Component Types |
| latitude |
The latititude of the location |
| longitude | The longitude of the location |
| formatted-address | The full address formatted as a string |
| address-type | The type of address, see Address Types |
Returns:
|
{ "result": [ { "created": { "time": "time", "user": { "id": "user-id", "detail": { "givenName": "given-name", "surname": "surname", "displayName": "display-name", "email": "account-email" } } }, "updated": { "time": "time", "user": { "id": "user-id", "detail": { "givenName": "given-name", "surname": "surname", "displayName": "display-name", "email": "account-email" } } }, "id": "location-id", "name": "location-name", "description": "location-description", "organization": { "id": "organisation-id" }, "address": { "components": [ { "name": { "long": "long-name", "short": "short-name" }, "types": [ "component-type" ] } ], "location": { "latitude": "latitude", "longitude": "longitude" }, "formatted": "formatted-address" }, "viewport": { "northeast": { "latitude": "latitude", "longitude": "longitude" }, "southwest": { "latitude": "latitude", "longitude": "longitude" } } }, "type": "address-type", ], } |
| Output | Description |
|---|---|
| time | The hub time, shown as an integer in ms |
| user-id | This is the id of the user as a unique 128-bit number |
| given-name | The first name of the user |
| surname | The surname of the user |
| display-name | The account name of the user |
| account-email | The email of the user |
| location-id | This is the unique id of the location |
| location-name | This is the user defined name of the location |
| organisation-id | This is the unique id of the organisation |
| long-name | The full name of the component |
| short-name | The shorthand version of the name of the component |
| component-type | The address component type see Address Component Types |
| latitude |
The latititude of the location |
| longitude | The longitude of the location |
| formatted-address | The full address formatted as a string |
| address-type | The type of address, see Address Types |
Example
{
"result": {
"id": "337a0e54-2699-4bca-9357-bb87092ecd92",
"name": "Office",
"description": "Office",
"organization": {
"id": "dafc70d5-a4c8-42a3-ad8d-a8ccb5fa313f"
},
"address": {
"components": [
{
"name": {
"long": "The Maurice Wilkes Building",
"short": "The Maurice Wilkes Building"
},
"types": [
"premise"
]
},
{
"name": {
"long": "Cowley Road",
"short": "Cowley Rd"
},
"types": [
"route"
]
},
{
"name": {
"long": "Cambridgeshire",
"short": "Cambridgeshire"
},
"types": [
"administrative_area_level_2",
"political"
]
},
{
"name": {
"long": "England",
"short": "England"
},
"types": [
"administrative_area_level_1",
"political"
]
},
{
"name": {
"long": "CB4 0DS",
"short": "CB4 0DS"
},
"types": [
"postal_code"
]
},
{
"name": {
"long": "United Kingdom",
"short": "GB"
},
"types": [
"country",
"political"
]
}
],
"location": {
"latitude": 52.23316289999999,
"longitude": 0.1513396
},
"formatted": "The Maurice Wilkes Building, Cowley Rd, Cambridge CB4 0DS, UK"
},
"type": "office"
}
}
}
Errors
If there is an error in the API method then JSON-RPC Error Object a will be returned