Users

Currently Authenticated User

This returns the user that is authorized using the API Key.

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

CURL
AUTOZNETWORK_TOKEN="your API token"

curl https://api.autoznetwork.com/v1/me \
  -H "Authorization: Bearer $AUTOZNETWORK_TOKEN" \
  -H 'Accept: application/json'

List Users

This returns the user that is authorized using the API Key.

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

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

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

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

print($users)

Add a User

If the user already exists in the autoZnetwork platform (based on email) then they will be sent an invitation to the specified organization.

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

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

curl -X POST https://api.autoznetwork.com/v1/users \
  -H "Authorization: Bearer $AUTOZNETWORK_TOKEN" \
  -H "X-AutozNetwork-Organization-Id: $AUTOZNETWORK_ORG_ID" \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
    "first_name": "John",
    "last_name": "Doe",
    "phone_number": "+1234567890",
    "email": "user@mydealership.com",
  }'
PHP
<?php 
$apiToken = 'ABCD12345 ...';
$organizationId = '1234';

$autoZnetwork = new AutozNetwork($apiToken);

$user = $autoZnetwork
              ->withOrganization($organizationId)
              ->users()
              ->create([
                'first_name' => 'John',
                'last_name' => 'Doe',
                'phone_number' => '+1234567890',
                'email' => 'user@mydealership.com'
              ]);

print($user)