Locations (Rooftops)

A location belongs to an organization and is a traditional rooftop for a dealership. This is a parent child relationship, an organization should always have at least one location.

A Location instance resource represents a location within your Organization.

The inventory list resource represents all of the locations that you have created in your account within autoZnetwork. You can POST to the Location resource to create a new location.

Properties

PropertyTypeDescription
idIntegerThe ID of the Location.
activeBooleanIdentifies the Location as active. Use this as an alternative to deleting the location.
nameStringFriendly name for the Location.
phone_numberStringAssociated phone number.
emailStringAssociated email address.
crm_emailStringAssociated CRM email for ADF formatted emails.
street_addressStringAssociated street address.
cityStringAssociated city.
stateStringAssociated state (2 Characters IE: WA, TX, AZ).
zipStringAssociated zip code.
coordinatesObjectLatitude and Longitude for the location.
ip_addressStringIP address associated the location.
activeBooleanToggles the location's active status.
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 belongs to.
Location GroupThe Location Group that the Location belongs to.

List Locations

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

CURL
AUTOZNETWORK_TOKEN="your API token"
AUTOZNETWORK_ORG_ID="your organization id"

curl https://api.autoznetwork.com/v1/locations \
  -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);

$locations = $autoznetwork
              ->withOrganization($organizationId)
              ->locations()
              ->get();

print($locations)

Add a Location

POST Request: https://api.autoznetwork.com/v1/locations

CURL
AUTOZNETWORK_TOKEN="your API token"
AUTOZNETWORK_ORG_ID="your organization id"

curl -X POST https://api.autoznetwork.com/v1/locations \
  -H "Authorization: Bearer $AUTOZNETWORK_TOKEN" \
  -H "X-AutozNetwork-Organization-Id: $AUTOZNETWORK_ORG_ID" \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
    "active": true,
    "name": "your location name",
    "phone_number": "+1234567890",
    "email": "location@mydealership.com",
    "crm_email": "crm_email@mydealership.com",
    "street_address": "1234 N St",
    "city": "Seattle",
    "state": "WA",
    "zip": "12345"
  }'
PHP
<?php 
$apiToken = 'ABCD12345 ...';
$organizationId = '1234';

$autoZnetwork = new AutozNetwork($apiToken);

$location = $autoZnetwork
              ->withOrganization($organizationId)
              ->locations()
              ->create([
                'active' => true,
                'name' => 'your location name'
              ]);

print($location)

Update a Location

PUT Request: https://api.autoznetwork.com/v1/locations/{LOCATION_ID}

CURL
AUTOZNETWORK_TOKEN="your API token"
AUTOZNETWORK_ORG_ID="your organization id"
AUTOZNETWORK_LOCATION_ID="your location id"

curl -X PUT https://api.autoznetwork.com/v1/locations/$AUTOZNETWORK_LOCATION_ID \
  -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 name",
  }'
PHP
<?php 
$apiToken = 'ABCD12345 ...';
$organizationId = '1234';

$autoZnetwork = new AutozNetwork($apiToken);

$location = $autoZnetwork
              ->withOrganization($organizationId)
              ->locations()
              ->update([
                'name' => 'your NEW location name'
              ]);

print($location)

Remove a Location

DELETE Request: https://api.autoznetwork.com/v1/locations/{LOCATION_ID}

CURL
AUTOZNETWORK_TOKEN="your API token"
AUTOZNETWORK_ORG_ID="your organization id"
AUTOZNETWORK_LOCATION_ID="your location id"

curl -X DELETE https://api.autoznetwork.com/v1/locations/$AUTOZNETWORK_LOCATION_ID \
  -H "Authorization: Bearer $AUTOZNETWORK_TOKEN" \
  -H "X-AutozNetwork-Organization-Id: $AUTOZNETWORK_ORG_ID" \
  -H 'Accept: application/json'
PHP
<?php 
$apiToken = 'ABCD12345 ...';
$organizationId = '1234';
$locationId = '9876';

$autoZnetwork = new AutozNetwork($apiToken);

$location = $autoZnetwork
              ->withOrganization($organizationId)
              ->locations($locationId)
              ->delete();

print($location)