Before you can get started using the autoZnetwork APIs, you must:
- Login or register for a new autoZnetwork account.
- Generate an API Token.
- Understand how to make API requests.
This topic describes how to get started using the autoZnetwork APIs.
Log in or register for an account
Before you can use any autoZnetwork APIs, you need to log in to your account or, if you don't have one, create a new one. Creating an account is easy:
- Go to the autoZnetwork Registration page.
- Enter your information and click Register for a free account.
Generating a new token
- Click on your avatar, and go to to account settings, from here navigate to API Tokens.
- Give your token a name, select the permissions you would like to allow for this individual API Token.
Requests
autoZnetwork API requests are straightforward, but there are several details to know when making requests.
Constructing a URI
autoZnetwork URIs follow a standard syntax using the format of https://api.autoznetwork.com/{API Version}/{API path}
Making the request
The following steps walk through retrieving your inventory by making a GET request to /inventory using v1 of the API.
- Before you make your request, confirm you have a valid API token as listed above.
- Make a cURL request with the API token in your header as well as the "X-AutozNetwork-Organization-Id" for any resources that require it. Almost all endpoints require the usage of this header.
AUTOZNETWORK_TOKEN="your API token"
AUTOZNETWORK_ORG_ID="your organization id"
curl https://api.autoznetwork.com/v1/inventory \
-H "Authorization: Bearer $AUTOZNETWORK_TOKEN" \
-H "X-AutozNetwork-Organization-Id: $AUTOZNETWORK_ORG_ID" \
-H 'Accept: application/json'
Listing resources
AUTOZNETWORK_TOKEN="your API token"
AUTOZNETWORK_ORG_ID="your organization id"
curl https://api.autoznetwork.com/v1/{RESOURCE} \
-H "Authorization: Bearer $AUTOZNETWORK_TOKEN" \
-H "X-AutozNetwork-Organization-Id: $AUTOZNETWORK_ORG_ID" \
-H 'Accept: application/json'
Get an individual resource
AUTOZNETWORK_TOKEN="your API token"
AUTOZNETWORK_ORG_ID="your organization id"
curl https://api.autoznetwork.com/v1/{RESOURCE}/{RESOURCE_ID} \
-H "Authorization: Bearer $AUTOZNETWORK_TOKEN" \
-H "X-AutozNetwork-Organization-Id: $AUTOZNETWORK_ORG_ID" \
-H 'Accept: application/json'
Create a resource
AUTOZNETWORK_TOKEN="your API token"
AUTOZNETWORK_ORG_ID="your organization id"
curl -X POST https://api.autoznetwork.com/v1/{RESOURCE} \
-H "Authorization: Bearer $AUTOZNETWORK_TOKEN" \
-H "X-AutozNetwork-Organization-Id: $AUTOZNETWORK_ORG_ID" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"key": "value",
}'
Updating a resource
AUTOZNETWORK_TOKEN="your API token"
AUTOZNETWORK_ORG_ID="your organization id"
curl -X PUT https://api.autoznetwork.com/v1/{RESOURCE}/{RESOURCE_ID} \
-H "Authorization: Bearer $AUTOZNETWORK_TOKEN" \
-H "X-AutozNetwork-Organization-Id: $AUTOZNETWORK_ORG_ID" \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"key": "value",
}'
Deleting a resource
AUTOZNETWORK_TOKEN="your API token"
AUTOZNETWORK_ORG_ID="your organization id"
curl -X DELETE https://api.autoznetwork.com/v1/{RESOURCE}/{RESOURCE_ID} \
-H "Authorization: Bearer $AUTOZNETWORK_TOKEN" \
-H "X-AutozNetwork-Organization-Id: $AUTOZNETWORK_ORG_ID" \
-H 'Accept: application/json'
Response Codes
autoZnetwork API response content varies but will exclusively be returned in JSON. For the most part, the content responses can be diveded as:
Error Codes
Code | Status Name | Description |
---|---|---|
200 | OK | Request has succeeded. |
201 | Created | Request has succeeded and has led to the creation of a resource. |
Example Response
200 OK
{
"id": 2,
"stock": "12345",
"name": "2018 Ford F-150 XLT SVT Raptor 4x4",
"lifted": false,
"lowered": false,
"make": "Ford",
"model": "F-150",
"trim": "XLT SVT Raptor 4x4",
"body_style": "Truck",
"created_at": "2020-07-29 16:08:30",
"updated_at": "2020-07-29 16:08:30",
"organization": {
"id": 11,
"name": "Your Dealership",
},
}
Error Handling
When you make an API call you may receive an error message in the response. Either there is something wrong with your request or something went wrong on our end. Errors respond with an error code and possibly a JSON body that contains a more precise message code.
Error Codes
Code | Status Name | Description |
---|---|---|
400 | Bad Request | Check your request and try again. |
401 | Unauthorized | Make sure your API Key is valid. |
403 | Forbidden | Make sure you have the proper privileges to access the resource. |
404 | Not Found | Change your request URL to match a valid API endpoint. |
422 | Unprocessable Entity | Check your request and try again. |
429 | Too Many Requests | Make sure you are not over your rate limits. |
500 | Server Error | Try the request again later. If the error does not resolve contact support. |
503 | Service Unavailable | We are experiencing higher than normal levels of traffic, retry the request again. |
504 | Gateway Timeout | A downstream API has timed out or failed to return a response, try the request again. |
Example Error
403 Forbidden
"errors": {
"code": 403,
"messages": [
"User does not have have access to this organization."
]
}
Read the API reference
When you're finished setting up and ready to go, check out the API reference documentation to view the public APIs for autoZnetwork.