NAV
bash javascript

TruckPartsCross API

API Reference for Diesel Laptops' "TruckPartsCross" API Service.

Authentication

You should have been handed out an API key to use this service. (If not, please request yours)

The API expects you to include this API key in all your requests, in a header that looks like the following:

X-Authorization: api-key

Comments

List comments

Get a list of comments.

Route Bindings

(no route bindings)

Query Parameters

Parameter Type Status Description
part_id number optional restrict comments to only those for that part ID

Example request:

curl -X GET "https://api-truckpartscross.com/api/v1/comment" \
-H "Accept: application/json"
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api-truckpartscross.com/api/v1/comment",
    "method": "GET",
    "headers": {
        "accept": "application/json"
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

Example response:

null

HTTP Request

GET api/v1/comment

HEAD api/v1/comment

Retrieve a Comment

Fetch an existing comment.

Route Bindings

Binding Type Status Description
id number required the id of the comment to fetch.

Query Parameters

(no query parameters)

Example request:

curl -X GET "https://api-truckpartscross.com/api/v1/comment/{id}" \
-H "Accept: application/json"
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api-truckpartscross.com/api/v1/comment/{id}",
    "method": "GET",
    "headers": {
        "accept": "application/json"
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

Example response:

null

HTTP Request

GET api/v1/comment/{id}

HEAD api/v1/comment/{id}

Update a Comment

Update an existing comment.

Route Bindings

Binding Type Status Description
part_id number required the id of the part to attach the comment to.
user_source number required source of the comment; must always be 1 (truckinfo.com)
user_id number required Id of the comment's author
user_name string required Name of the comment's author
like boolean required One of 1 (like) or 0 (dislike)
comment text required The actual comment from the author

Query Parameters

(no query parameters)

Example request:

curl -X PUT "https://api-truckpartscross.com/api/v1/comment/{id}" \
-H "Accept: application/json"
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api-truckpartscross.com/api/v1/comment/{id}",
    "method": "PUT",
    "headers": {
        "accept": "application/json"
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

Example response:

null

HTTP Request

PUT api/v1/comment/{id}

Add a Comment

Create a new comment for a part.

Route Bindings

Binding Type Status Description
part_id number required the id of the part to attach the comment to.
user_source number required source of the comment; must always be 1 (truckinfo.com)
user_id number required Id of the comment's author
user_name string required Name of the comment's author
like boolean required One of 1 (like) or 0 (dislike)
comment text required The actual comment from the author

Query Parameters

(no query parameters)

Example request:

curl -X POST "https://api-truckpartscross.com/api/v1/comment" \
-H "Accept: application/json"
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api-truckpartscross.com/api/v1/comment",
    "method": "POST",
    "headers": {
        "accept": "application/json"
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

Example response:

null

HTTP Request

POST api/v1/comment

Parts

Search For Part

Search through the list of parts.

Route Bindings

(no route bindings)

Query Parameters

Parameter Type Status Description
search string required full or partial part number to look for (min: 3 characters)
sort_by string optional what column to sort the results on; defaults to "number"
Possible values: number or manufacturer_name
sort_dir string optional sort direction; defaults to "asc"
Possible values: asc or desc
page number optional which page of results to return; defaults to page 1
per_page number optional how many rows to return, per page; defaults to 10, maximum 100

Example request:

curl -X GET "https://api-truckpartscross.com/api/v1/part/search" \
-H "Accept: application/json"
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api-truckpartscross.com/api/v1/part/search",
    "method": "GET",
    "headers": {
        "accept": "application/json"
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

Example response:

null

HTTP Request

GET api/v1/part/search

HEAD api/v1/part/search

Retrieve a Part

Get a Part and its equivalences.

Route Bindings

Binding Type Status Description
id number required the id of the part to fetch.

Query Parameters

(no query parameters)

Example request:

curl -X GET "https://api-truckpartscross.com/api/v1/part/{id}" \
-H "Accept: application/json"
var settings = {
    "async": true,
    "crossDomain": true,
    "url": "https://api-truckpartscross.com/api/v1/part/{id}",
    "method": "GET",
    "headers": {
        "accept": "application/json"
    }
}

$.ajax(settings).done(function (response) {
    console.log(response);
});

Example response:

null

HTTP Request

GET api/v1/part/{id}

HEAD api/v1/part/{id}