NAV -image
javascript

Introduction

This documentation aims to provide all the information you need to work with our API.

Base URL

https://api-cc.com

Authenticating requests

This API is authenticated by sending a DL-Authorization header with the value "{YOUR_AUTH_KEY}".

All authenticated endpoints are marked with a requires authentication badge in the documentation below.

You get API token in the response after Authorization on https://api.users.diesellaptops.com.

Access

Access

requires authentication

Get information if the user has access to the search and number of free searches. If number of free searches is unlimited -1 is returned.

Example request:

const url = new URL(
    "https://api-cc.com/api/v1/access"
);

let headers = {
    "DL-Authorization": "{YOUR-API-KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):

{
    "data": {
        "access": true,
        "free_searches": 1
    }
}

Example response (401):

{
    "message": "Unauthenticated."
}

Request   

GET api/v1/access

Category

List

requires authentication

Retrieve all categories with subcategories

Example request:

const url = new URL(
    "https://api-cc.com/api/v1/category"
);

let params = {
    "sort_by": "name",
    "sort_dir": "desc",
    "page": "14",
    "per_page": "13",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "DL-Authorization": "{YOUR-API-KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):

{
    "data": [
        {
            "id": 1,
            "parent_id": null,
            "name": "Truck Repair",
            "special_fields": false,
            "has_manufacturers": false,
            "children": [
                {
                    "id": 2,
                    "parent_id": 1,
                    "name": "Dealership",
                    "special_fields": false,
                    "has_manufacturers": false,
                    "children": []
                }
            ]
        }
    ],
    "links": {
        "first": "https:\/\/api-cc.com\/api\/v1\/category?page=1",
        "last": "https:\/\/api-cc.com\/api\/v1\/category?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "https:\/\/api-cc.com\/api\/v1\/category",
        "per_page": 10,
        "to": 3,
        "total": 3
    }
}

Example response (401):

{
    "message": "Unauthenticated."
}

Request   

GET api/v1/category

Query Parameters

sort_by  string optional  
What column to sort the results on. Default: 'name'.

sort_dir  string optional  
Sort direction. Default: 'asc'. Possible values: 'asc', 'desc'.

page  integer optional  
Which page of results to return. Default: 1.

per_page  integer optional  
How many rows to return per page. Default: 10; maximum: 100. example: 20

Company

List

requires authentication

Retrieve all companies. You should be subscribed to the Customer Connect Service otherwise you're limited by 2 requests per month.

Example request:

const url = new URL(
    "https://api-cc.com/api/v1/company"
);

let params = {
    "zip": "12345",
    "radius": "102733873.3621",
    "trucks_owned_from": "3",
    "trucks_owned_to": "8",
    "category_id": "19",
    "manufacturer_id": "18",
    "state": "sit",
    "sort_by": "name",
    "sort_dir": "desc",
    "page": "4",
    "per_page": "12",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "DL-Authorization": "{YOUR-API-KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):

{
    "data": [
        {
            "id": 14,
            "category_id": 4,
            "manufacturer_id": 1,
            "hierarchy": [
                {
                    "id": 1,
                    "name": "Truck Repair"
                },
                {
                    "id": 4,
                    "name": "Independent Garage"
                }
            ],
            "name": "West Memphis Diesel & Truck Repair",
            "address_line_1": "604 Balfour Rd",
            "address_line_2": "",
            "city": "West Memphis",
            "state": "AR",
            "zip": "72301",
            "address": "604 Balfour Rd, West Memphis, AR 72301, USA",
            "phone": "+1 901-652-2545",
            "website": "http:\/\/www.westmemphistrucktrailerrepair.com",
            "contact_name": "John Doe",
            "contact_title": "Mr.",
            "lat": 35.163535,
            "lng": -90.1975975,
            "us_dot": null,
            "trucks_owned": null,
            "drivers": null
        }
    ],
    "links": {
        "first": "https:\/\/api-cc.com\/api\/v1\/company?page=1",
        "last": "https:\/\/api-cc.com\/api\/v1\/company?page=3",
        "prev": null,
        "next": "https:\/\/api-cc.com\/api\/v1\/company?page=2"
    },
    "meta": {
        "current_page": 1,
        "free_searches": -1,
        "from": 1,
        "last_page": 3,
        "path": "https:\/\/api-cc.com\/api\/v1\/company",
        "per_page": 10,
        "to": 10,
        "total": 25
    }
}

Example response (401):

{
    "message": "Unauthenticated."
}

Request   

GET api/v1/company

Query Parameters

zip  string optional  
optional Postal code.

radius  number optional  
Look for postal codes in this radius (in miles). Default: 0.

trucks_owned_from  integer optional  
Minimal number of trucks owned.

trucks_owned_to  integer optional  
Maximum number of trucks owned.

category_id  integer optional  
ID of the category.

manufacturer_id  integer optional  
ID of the manufacturer.

state  string optional  
State.

sort_by  string optional  
What column to sort the results on. Default: 'name'.

sort_dir  string optional  
Sort direction. Default: 'asc'. Possible values: 'asc', 'desc'.

page  integer optional  
Which page of results to return. Default: 1.

per_page  integer optional  
How many rows to return per page. Default: 10; maximum: 100. example: 20

Report Issue

requires authentication

Report bad data about the company.

Example request:

const url = new URL(
    "https://api-cc.com/api/v1/company/1/report-issue"
);

let params = {
    "issue": "ex",
    "user_name": "neque",
    "user_email": "aut",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "DL-Authorization": "{YOUR-API-KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());

Example response (200):

{
    "message": "You issue report is submitted."
}

Request   

POST api/v1/company/{id}/report-issue

URL Parameters

id  integer optional  
ID of the company.

Query Parameters

issue  string  
Issue description.

user_name  string  
Name of the user reporting issue.

user_email  string  
Email of the user reporting issue.

Manufacturer

List

requires authentication

Retrieve all manufacturers.

Example request:

const url = new URL(
    "https://api-cc.com/api/v1/manufacturer"
);

let params = {
    "sort_by": "name",
    "sort_dir": "desc",
    "page": "1",
    "per_page": "6",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

let headers = {
    "DL-Authorization": "{YOUR-API-KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());

Example response (200):

{
    "data": [
        {
            "id": 3,
            "name": "Caterpillar"
        }
    ]
}

Example response (401):

{
    "message": "Unauthenticated."
}

Request   

GET api/v1/manufacturer

Query Parameters

sort_by  string optional  
What column to sort the results on. Default: 'name'.

sort_dir  string optional  
Sort direction. Default: 'asc'. Possible values: 'asc', 'desc'.

page  integer optional  
Which page of results to return. Default: 1.

per_page  integer optional  
How many rows to return per page. Default: 10; maximum: 100. example: 20