Location Groups
Interface with the autoZnetwork location groups.
Location Groups
**A default location group is created for every organization.
A Location Group instance resource represents a group of locations within an Organization. This is usually used for locations within close proximity.
Properties
| Property | Type | Description |
|---|---|---|
id | Integer | The ID of the Location. |
default | Boolean | Identifies the Location Group as default. |
name | String | Friendly name for the Location. |
coordinates | Object | Latitude and Longitude of a central point for the group. |
created_at | DateTime | DateTime the Location was created in autoZnetwork's system. |
updated_at | DateTime | DateTime the Location was last updated in autoZnetwork's system. |
Relationships
| Relationship | Description |
|---|---|
| Organization | The Organization the Location Group belongs to. |
| Locations | The locations that are contained within the Location Group. |
List Location Groups
GET Request: https://api.autoznetwork.com/v1/location_groups
AUTOZNETWORK_TOKEN="your API token"
AUTOZNETWORK_ORG_ID="your organization id"
curl https://api.autoznetwork.com/v1/location_groups \
-H "Authorization: Bearer $AUTOZNETWORK_TOKEN" \
-H "X-AutozNetwork-Organization-Id: $AUTOZNETWORK_ORG_ID" \
-H 'Accept: application/json'
<?php
$apiToken = 'ABCD12345 ...';
$organizationId = '1234';
$autoZnetwork = new AutozNetwork($apiToken);
$locationGroups = $autoznetwork
->withOrganization($organizationId)
->locationGroups()
->get();
print($locationGroups)
Add a Location Group
POST Request: https://api.autoznetwork.com/v1/location_groups
AUTOZNETWORK_TOKEN="your API token"
AUTOZNETWORK_ORG_ID="your organization id"
curl -X POST https://api.autoznetwork.com/v1/location_groups \
-H "Authorization: Bearer $AUTOZNETWORK_TOKEN" \
-H "X-AutozNetwork-Organization-Id: $AUTOZNETWORK_ORG_ID" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"name": "your location group name",
}'
<?php
$apiToken = 'ABCD12345 ...';
$organizationId = '1234';
$autoZnetwork = new AutozNetwork($apiToken);
$locationGroup = $autoZnetwork
->withOrganization($organizationId)
->locationGrups()
->create([
'active' => true,
'name' => 'your location name'
]);
print($locationGroup)
Update a Location Group
PUT Request: https://api.autoznetwork.com/v1/location_groups/{LOCATION_GROUP_ID}
AUTOZNETWORK_TOKEN="your API token"
AUTOZNETWORK_ORG_ID="your organization id"
curl -X PUT https://api.autoznetwork.com/v1/location_groups \
-H "Authorization: Bearer $AUTOZNETWORK_TOKEN" \
-H "X-AutozNetwork-Organization-Id: $AUTOZNETWORK_ORG_ID" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"name": "your NEW location group name",
}'
<?php
$apiToken = 'ABCD12345 ...';
$organizationId = '1234';
$autoZnetwork = new AutozNetwork($apiToken);
$locationGroup = $autoZnetwork
->withOrganization($organizationId)
->locationGroups()
->update([
'name' => 'your NEW location group name'
]);
print($locationGroup)
Remove a Location Group
DELETE Request: https://api.autoznetwork.com/v1/location_groups/{LOCATION_GROUP_ID}
AUTOZNETWORK_TOKEN="your API token"
AUTOZNETWORK_ORG_ID="your organization id"
AUTOZNETWORK_LOCATION_GROUP_ID="your location id"
curl -X DELETE https://api.autoznetwork.com/v1/location_groups/$AUTOZNETWORK_LOCATION_GROUP_ID \
-H "Authorization: Bearer $AUTOZNETWORK_TOKEN" \
-H "X-AutozNetwork-Organization-Id: $AUTOZNETWORK_ORG_ID" \
-H 'Accept: application/json'
<?php
$apiToken = 'ABCD12345 ...';
$organizationId = '1234';
$locationGroupId = '9876';
$autoZnetwork = new AutozNetwork($apiToken);
$location = $autoZnetwork
->withOrganization($organizationId)
->locationGroups($locationGroupId)
->delete();
print($location)