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

PropertyTypeDescription
idIntegerThe ID of the Location.
defaultBooleanIdentifies the Location Group as default.
nameStringFriendly name for the Location.
coordinatesObjectLatitude and Longitude of a central point for the group.
created_atDateTimeDateTime the Location was created in autoZnetwork's system.
updated_atDateTimeDateTime the Location was last updated in autoZnetwork's system.

Relationships

RelationshipDescription
OrganizationThe Organization the Location Group belongs to.
LocationsThe locations that are contained within the Location Group.

List Location Groups

GET Request: https://api.autoznetwork.com/v1/location_groups

CURL
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
<?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

CURL
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
<?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}

CURL
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
<?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}

CURL
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
<?php 
$apiToken = 'ABCD12345 ...';
$organizationId = '1234';
$locationGroupId = '9876';

$autoZnetwork = new AutozNetwork($apiToken);

$location = $autoZnetwork
              ->withOrganization($organizationId)
              ->locationGroups($locationGroupId)
              ->delete();

print($location)