Introduction
This documentation aims to provide all the information you need to work with our API.
Base URL
http://api-truckpartscross.local
Authenticating requests
To authenticate requests, include a X-Authorization
header with the value "{YOUR_AUTH_KEY}"
.
All authenticated endpoints are marked with a requires authentication
badge in the documentation below.
Categories
Category is represented by the first 3 digits of VMRS code. The same as VMRS System.
List
requires authentication
Get a list of categories (VMRS systems).
Example request:
const url = new URL(
"http://api-truckpartscross.local/api/v2/category"
);
let headers = {
"X-Authorization": "{api-key}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
Example response (200):
{
"data": [
{
"id": 1,
"code": "000",
"name": "Uncategorized",
"sub_category_count": 1
},
{
"id": 2,
"code": "001",
"name": "HVAC",
"sub_category_count": 7
},
{
"id": 3,
"code": "002",
"name": "Cab & Hood",
"sub_category_count": 59
}
]
}
Received response:
Request failed with error:
Search a Category in VMRS system
requires authentication
Search through VMRS systems.
Example request:
const url = new URL(
"http://api-truckpartscross.local/api/v2/category/search"
);
let params = {
"search": "consequatur",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"X-Authorization": "{api-key}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
Example response (200):
{
"data": [
{
"vmrs": "011",
"name": "Steer Axle Group-Non Driven"
},
{
"vmrs": "021",
"name": "Steer Axle Group-Driven"
},
{
"vmrs": "022",
"name": "Drive Axle Assembly-Driven"
},
{
"vmrs": "012-000",
"name": "Auxiliary Axles \/ Axles - Non-Driven, Rear"
},
{
"vmrs": "021-000",
"name": "Steer Axle Group-Driven \/ Axles - Driven, Front Steering"
},
{
"vmrs": "022-000",
"name": "Drive Axle Assembly-Driven \/ Axles - Driven, Rear"
},
{
"vmrs": "011-001",
"name": "Steer Axle Group-Non Driven \/ Axle Components - Non-Driven, Front"
},
{
"vmrs": "012-001",
"name": "Auxiliary Axles \/ Axle Components - Non-Driven, Rear"
},
{
"vmrs": "021-001",
"name": "Steer Axle Group-Driven \/ Axle Components - Driven Front Steer Axle"
},
{
"vmrs": "022-001",
"name": "Drive Axle Assembly-Driven \/ Axle Housing Components - Driven, Rear"
}
],
"meta": {
"found": 312
}
}
Received response:
Request failed with error:
Comments
List comments
requires authentication
Get a list of comments.
Example request:
const url = new URL(
"http://api-truckpartscross.local/api/v2/comment"
);
let params = {
"part_id": "1",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"X-Authorization": "{api-key}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
Example response (200):
{
"data": [
{
"id": 1,
"created_at": {
"date": "2018-07-30 03:56:03.000000",
"timezone_type": 3,
"timezone": "America\/New_York"
},
"part_id": 1004203,
"part_name": "Lube Filter",
"part_number": "LF3000",
"user_name": "John Doe",
"like": true,
"comment": "Great tool",
"date": "July 30, 2018",
"approved": true
}
],
"meta": {
"total": 18,
"found": 6,
"other_query_info": null
}
}
Received response:
Request failed with error:
Retrieve a Comment
requires authentication
Fetch an existing comment.
Example request:
const url = new URL(
"http://api-truckpartscross.local/api/v2/comment/20"
);
let headers = {
"X-Authorization": "{api-key}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
Example response (200):
{
"data": {
"id": 1,
"created_at": {
"date": "2018-07-30 03:56:03.000000",
"timezone_type": 3,
"timezone": "America\/New_York"
},
"part_id": 1004203,
"part_name": "Lube Filter",
"part_number": "LF3000",
"user_name": "John Doe",
"like": true,
"comment": "Great tool",
"date": "July 30, 2018",
"approved": true
}
}
Received response:
Request failed with error:
Add a Comment
requires authentication
Create a new comment for a part.
Example request:
const url = new URL(
"http://api-truckpartscross.local/api/v2/comment"
);
let params = {
"part_id": "19",
"user_source": "1",
"user_id": "15",
"user_name": "et",
"like": "",
"comment": "occaecati",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"X-Authorization": "{api-key}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());
Example response (200):
{
"data": {
"id": 53,
"created_at": {
"date": "2019-02-14 11:22:58.000000",
"timezone_type": 3,
"timezone": "America\/New_York"
},
"part_id": 1,
"part_name": "Air Compressor",
"part_number": "N5060",
"user_name": "John Doe",
"like": true,
"comment": "Great tool",
"date": "February 14, 2019",
"approved": false
}
}
Received response:
Request failed with error:
Check if user can add Comment
requires authentication
Check if user can add new Comment for specified part.
Example request:
const url = new URL(
"http://api-truckpartscross.local/api/v2/comment/can-add"
);
let params = {
"part_id": "7",
"user_source": "1",
"user_id": "13",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"X-Authorization": "{api-key}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
Example response (200):
{
"result": true
}
Received response:
Request failed with error:
Component Parameters
Create
requires authentication
Create the component parameter.
Example request:
const url = new URL(
"/api/component_param"
);
let params = {
"component_id": "1",
"name": "autem",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"X-Authorization": "{api-key}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());
Example response (200):
{
"data": {
"id": 23,
"component_id": 10,
"name": "Spline Diameter",
"slug": "spline_diameter",
"order": 3
}
}
Received response:
Request failed with error:
Update
requires authentication
Update the component parameter.
Example request:
const url = new URL(
"/api/component_param/18"
);
let params = {
"component_id": "2",
"name": "accusamus",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"X-Authorization": "{api-key}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "PUT",
headers,
}).then(response => response.json());
Example response (200):
{
"data": {
"id": 23,
"component_id": 10,
"name": "Spline Diameter",
"slug": "spline_diameter",
"order": 3
}
}
Received response:
Request failed with error:
Delete
requires authentication
Delete the component parameter
Example request:
const url = new URL(
"/api/component_param/2"
);
let headers = {
"X-Authorization": "{api-key}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());
Example response (200):
[]
Received response:
Request failed with error:
Components
List
requires authentication
Get the list of components.
Example request:
const url = new URL(
"/api/component"
);
let params = {
"sort_by": "name",
"sort_dir": "asc",
"page": "15",
"per_page": "20",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"X-Authorization": "{api-key}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
Example response (200):
{
"data": [
{
"id": 20,
"name": "Air System - Air Dryers",
"notes": null,
"image": "https:\/\/api-truckpartscross.com\/storage\/public\/component_images\/WrJcNEo6Tv9bIw6lyPNrQIZOfOS8kYWJurFMIMgM.png",
"images": [
{
"id": 5,
"url": "https:\/\/api-truckpartscross.com\/storage\/public\/component_images\/WrJcNEo6Tv9bIw6lyPNrQIZOfOS8kYWJurFMIMgM.png",
"path": "public\/component_images\/WrJcNEo6Tv9bIw6lyPNrQIZOfOS8kYWJurFMIMgM.png"
}
],
"params": [
{
"id": 130,
"component_id": 20,
"name": "Manufacturer",
"slug": "manufacturer",
"order": 1
}
],
"manufacturers": [
{
"id": 3,
"name": "Bendix",
"default": 0
}
]
}
]
}
Received response:
Request failed with error:
Retrieve
requires authentication
Retrieve a specified component. In the retrieved component will be shown only parts from the default manufacturer. If no default manufacturer is specified the first one is considered as the default.
Example request:
const url = new URL(
"/api/component/1"
);
let params = {
"manufacturer_id": "7",
"all_manufacturers": "1",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"X-Authorization": "{api-key}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
Example response (200):
{
"data": {
"id": 20,
"name": "Air System - Air Dryers",
"notes": null,
"image": "http:\/\/api-truckpartscross.local\/storage\/public\/component_images\/WrJcNEo6Tv9bIw6lyPNrQIZOfOS8kYWJurFMIMgM.png",
"images": [
{
"id": 5,
"url": "http:\/\/api-truckpartscross.local\/storage\/public\/component_images\/WrJcNEo6Tv9bIw6lyPNrQIZOfOS8kYWJurFMIMgM.png",
"path": "public\/component_images\/WrJcNEo6Tv9bIw6lyPNrQIZOfOS8kYWJurFMIMgM.png"
}
],
"params": [
{
"id": 130,
"component_id": 20,
"name": "Manufacturer",
"slug": "manufacturer",
"order": 1
}
],
"manufacturers": [
{
"id": 3,
"name": "Bendix",
"default": 0
}
],
"parts": [
{
"id": 186128,
"number": "800959",
"name": "DRYER_AIR",
"manufacturer_id": 3,
"manufacturer_name": "Bendix",
"notes": "Has 1\/4\" NPT auxiliary inlet port",
"params": {
"manufacturer": "Bendix",
"style": "AD-IS",
"voltage": "12V",
"wattage": "90W",
"port_size": "1\/2\"",
"purge_valve": "n\/a",
"purge_volume": "Standard",
"new_or_reman": "New",
"with_sc-pr_valve": "No",
"includes_mounting_bracket": "n\/a",
"application": "Chevrolet GMC Kodiak & Topkick C-Models"
},
"accessory": null
}
]
}
}
Received response:
Request failed with error:
Create
requires authentication
Create the component
Example request:
const url = new URL(
"/api/component"
);
let params = {
"name": "sit",
"notes": "molestiae",
"image": "voluptatem",
"default_manufacturer_id": "17",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"X-Authorization": "{api-key}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());
Example response (200):
{
"data": {
"id": 20,
"name": "Air System - Air Dryers",
"notes": null,
"image": "http:\/\/api-truckpartscross.local\/storage\/public\/component_images\/WrJcNEo6Tv9bIw6lyPNrQIZOfOS8kYWJurFMIMgM.png",
"images": [
{
"id": 5,
"url": "http:\/\/api-truckpartscross.local\/storage\/public\/component_images\/WrJcNEo6Tv9bIw6lyPNrQIZOfOS8kYWJurFMIMgM.png",
"path": "public\/component_images\/WrJcNEo6Tv9bIw6lyPNrQIZOfOS8kYWJurFMIMgM.png"
}
],
"params": [
{
"id": 130,
"component_id": 20,
"name": "Manufacturer",
"slug": "manufacturer",
"order": 1
}
],
"manufacturers": [
{
"id": 3,
"name": "Bendix",
"default": 0
}
],
"parts": [
{
"id": 186128,
"number": "800959",
"name": "DRYER_AIR",
"manufacturer_id": 3,
"manufacturer_name": "Bendix",
"notes": "Has 1\/4\" NPT auxiliary inlet port",
"params": {
"manufacturer": "Bendix",
"style": "AD-IS",
"voltage": "12V",
"wattage": "90W",
"port_size": "1\/2\"",
"purge_valve": "n\/a",
"purge_volume": "Standard",
"new_or_reman": "New",
"with_sc-pr_valve": "No",
"includes_mounting_bracket": "n\/a",
"application": "Chevrolet GMC Kodiak & Topkick C-Models"
},
"accessory": null
}
]
}
}
Received response:
Request failed with error:
Update
requires authentication
Example request:
const url = new URL(
"/api/component/6"
);
let params = {
"name": "omnis",
"notes": "vero",
"image": "possimus",
"default_manufacturer_id": "7",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"X-Authorization": "{api-key}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "PUT",
headers,
}).then(response => response.json());
Example response (200):
{
"data": {
"id": 20,
"name": "Air System - Air Dryers",
"notes": null,
"image": "http:\/\/api-truckpartscross.local\/storage\/public\/component_images\/WrJcNEo6Tv9bIw6lyPNrQIZOfOS8kYWJurFMIMgM.png",
"images": [
{
"id": 5,
"url": "http:\/\/api-truckpartscross.local\/storage\/public\/component_images\/WrJcNEo6Tv9bIw6lyPNrQIZOfOS8kYWJurFMIMgM.png",
"path": "public\/component_images\/WrJcNEo6Tv9bIw6lyPNrQIZOfOS8kYWJurFMIMgM.png"
}
],
"params": [
{
"id": 130,
"component_id": 20,
"name": "Manufacturer",
"slug": "manufacturer",
"order": 1
}
],
"manufacturers": [
{
"id": 3,
"name": "Bendix",
"default": 0
}
],
"parts": [
{
"id": 186128,
"number": "800959",
"name": "DRYER_AIR",
"manufacturer_id": 3,
"manufacturer_name": "Bendix",
"notes": "Has 1\/4\" NPT auxiliary inlet port",
"params": {
"manufacturer": "Bendix",
"style": "AD-IS",
"voltage": "12V",
"wattage": "90W",
"port_size": "1\/2\"",
"purge_valve": "n\/a",
"purge_volume": "Standard",
"new_or_reman": "New",
"with_sc-pr_valve": "No",
"includes_mounting_bracket": "n\/a",
"application": "Chevrolet GMC Kodiak & Topkick C-Models"
},
"accessory": null
}
]
}
}
Received response:
Request failed with error:
Delete
requires authentication
Delete the component
Example request:
const url = new URL(
"/api/component/4"
);
let headers = {
"X-Authorization": "{api-key}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());
Example response (200):
[]
Received response:
Request failed with error:
Attach image
requires authentication
Attach an image to the component
Example request:
const url = new URL(
"/api/component/18/attach"
);
let params = {
"attachment": "enim",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"X-Authorization": "{api-key}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());
Example response (200):
{
"data": {
"id": 20,
"name": "Air System - Air Dryers",
"notes": null,
"image": "http:\/\/api-truckpartscross.local\/storage\/public\/component_images\/WrJcNEo6Tv9bIw6lyPNrQIZOfOS8kYWJurFMIMgM.png",
"images": [
{
"id": 5,
"url": "http:\/\/api-truckpartscross.local\/storage\/public\/component_images\/WrJcNEo6Tv9bIw6lyPNrQIZOfOS8kYWJurFMIMgM.png",
"path": "public\/component_images\/WrJcNEo6Tv9bIw6lyPNrQIZOfOS8kYWJurFMIMgM.png"
}
],
"params": [
{
"id": 130,
"component_id": 20,
"name": "Manufacturer",
"slug": "manufacturer",
"order": 1
}
],
"manufacturers": [
{
"id": 3,
"name": "Bendix",
"default": 0
}
],
"parts": [
{
"id": 186128,
"number": "800959",
"name": "DRYER_AIR",
"manufacturer_id": 3,
"manufacturer_name": "Bendix",
"notes": "Has 1\/4\" NPT auxiliary inlet port",
"params": {
"manufacturer": "Bendix",
"style": "AD-IS",
"voltage": "12V",
"wattage": "90W",
"port_size": "1\/2\"",
"purge_valve": "n\/a",
"purge_volume": "Standard",
"new_or_reman": "New",
"with_sc-pr_valve": "No",
"includes_mounting_bracket": "n\/a",
"application": "Chevrolet GMC Kodiak & Topkick C-Models"
},
"accessory": null
}
]
}
}
Received response:
Request failed with error:
Detach image
requires authentication
Detach an image from the component. If image ID is not specified the last image is deleted.
Example request:
const url = new URL(
"/api/component/10/detach"
);
let headers = {
"X-Authorization": "{api-key}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());
Example response (200):
{
"data": {
"id": 20,
"name": "Air System - Air Dryers",
"notes": null,
"image": "http:\/\/api-truckpartscross.local\/storage\/public\/component_images\/WrJcNEo6Tv9bIw6lyPNrQIZOfOS8kYWJurFMIMgM.png",
"images": [
{
"id": 5,
"url": "http:\/\/api-truckpartscross.local\/storage\/public\/component_images\/WrJcNEo6Tv9bIw6lyPNrQIZOfOS8kYWJurFMIMgM.png",
"path": "public\/component_images\/WrJcNEo6Tv9bIw6lyPNrQIZOfOS8kYWJurFMIMgM.png"
}
],
"params": [
{
"id": 130,
"component_id": 20,
"name": "Manufacturer",
"slug": "manufacturer",
"order": 1
}
],
"manufacturers": [
{
"id": 3,
"name": "Bendix",
"default": 0
}
],
"parts": [
{
"id": 186128,
"number": "800959",
"name": "DRYER_AIR",
"manufacturer_id": 3,
"manufacturer_name": "Bendix",
"notes": "Has 1\/4\" NPT auxiliary inlet port",
"params": {
"manufacturer": "Bendix",
"style": "AD-IS",
"voltage": "12V",
"wattage": "90W",
"port_size": "1\/2\"",
"purge_valve": "n\/a",
"purge_volume": "Standard",
"new_or_reman": "New",
"with_sc-pr_valve": "No",
"includes_mounting_bracket": "n\/a",
"application": "Chevrolet GMC Kodiak & Topkick C-Models"
},
"accessory": null
}
]
}
}
Received response:
Request failed with error:
Detach image
requires authentication
Detach an image from the component. If image ID is not specified the last image is deleted.
Example request:
const url = new URL(
"/api/component/20/detach/8"
);
let headers = {
"X-Authorization": "{api-key}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());
Example response (200):
{
"data": {
"id": 20,
"name": "Air System - Air Dryers",
"notes": null,
"image": "http:\/\/api-truckpartscross.local\/storage\/public\/component_images\/WrJcNEo6Tv9bIw6lyPNrQIZOfOS8kYWJurFMIMgM.png",
"images": [
{
"id": 5,
"url": "http:\/\/api-truckpartscross.local\/storage\/public\/component_images\/WrJcNEo6Tv9bIw6lyPNrQIZOfOS8kYWJurFMIMgM.png",
"path": "public\/component_images\/WrJcNEo6Tv9bIw6lyPNrQIZOfOS8kYWJurFMIMgM.png"
}
],
"params": [
{
"id": 130,
"component_id": 20,
"name": "Manufacturer",
"slug": "manufacturer",
"order": 1
}
],
"manufacturers": [
{
"id": 3,
"name": "Bendix",
"default": 0
}
],
"parts": [
{
"id": 186128,
"number": "800959",
"name": "DRYER_AIR",
"manufacturer_id": 3,
"manufacturer_name": "Bendix",
"notes": "Has 1\/4\" NPT auxiliary inlet port",
"params": {
"manufacturer": "Bendix",
"style": "AD-IS",
"voltage": "12V",
"wattage": "90W",
"port_size": "1\/2\"",
"purge_valve": "n\/a",
"purge_volume": "Standard",
"new_or_reman": "New",
"with_sc-pr_valve": "No",
"includes_mounting_bracket": "n\/a",
"application": "Chevrolet GMC Kodiak & Topkick C-Models"
},
"accessory": null
}
]
}
}
Received response:
Request failed with error:
Import
requires authentication
Import component from CSV file.
Example request:
const url = new URL(
"/api/component/import"
);
let params = {
"import-data": "distinctio",
"manufacturer_id": "19",
"component_id": "16",
"notify": "qui",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"X-Authorization": "{api-key}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());
Example response (200):
{
"data": "The import has been scheduled. A notification will be sent to john.doe@example.com when it is completed."
}
Received response:
Request failed with error:
Add part
requires authentication
Add part to a component
Example request:
const url = new URL(
"/api/component/9/part"
);
let params = {
"manufacturer_part_id": "16",
"params": "est",
"accessory_id": "3",
"notes": "quod",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"X-Authorization": "{api-key}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());
Example response (200):
{
"data": {
"id": 20,
"name": "Air System - Air Dryers",
"notes": null,
"image": "http:\/\/api-truckpartscross.local\/storage\/public\/component_images\/WrJcNEo6Tv9bIw6lyPNrQIZOfOS8kYWJurFMIMgM.png",
"images": [
{
"id": 5,
"url": "http:\/\/api-truckpartscross.local\/storage\/public\/component_images\/WrJcNEo6Tv9bIw6lyPNrQIZOfOS8kYWJurFMIMgM.png",
"path": "public\/component_images\/WrJcNEo6Tv9bIw6lyPNrQIZOfOS8kYWJurFMIMgM.png"
}
],
"params": [
{
"id": 130,
"component_id": 20,
"name": "Manufacturer",
"slug": "manufacturer",
"order": 1
}
],
"manufacturers": [
{
"id": 3,
"name": "Bendix",
"default": 0
}
],
"parts": [
{
"id": 186128,
"number": "800959",
"name": "DRYER_AIR",
"manufacturer_id": 3,
"manufacturer_name": "Bendix",
"notes": "Has 1\/4\" NPT auxiliary inlet port",
"params": {
"manufacturer": "Bendix",
"style": "AD-IS",
"voltage": "12V",
"wattage": "90W",
"port_size": "1\/2\"",
"purge_valve": "n\/a",
"purge_volume": "Standard",
"new_or_reman": "New",
"with_sc-pr_valve": "No",
"includes_mounting_bracket": "n\/a",
"application": "Chevrolet GMC Kodiak & Topkick C-Models"
},
"accessory": null
}
]
}
}
Received response:
Request failed with error:
Update part
requires authentication
Update a part linked to the component
Example request:
const url = new URL(
"/api/component/et/part/8"
);
let params = {
"manufacturer_part_id": "14",
"params": "consequatur",
"accessory_id": "4",
"notes": "id",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"X-Authorization": "{api-key}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "PUT",
headers,
}).then(response => response.json());
Example response (200):
{
"data": {
"id": 20,
"name": "Air System - Air Dryers",
"notes": null,
"image": "http:\/\/api-truckpartscross.local\/storage\/public\/component_images\/WrJcNEo6Tv9bIw6lyPNrQIZOfOS8kYWJurFMIMgM.png",
"images": [
{
"id": 5,
"url": "http:\/\/api-truckpartscross.local\/storage\/public\/component_images\/WrJcNEo6Tv9bIw6lyPNrQIZOfOS8kYWJurFMIMgM.png",
"path": "public\/component_images\/WrJcNEo6Tv9bIw6lyPNrQIZOfOS8kYWJurFMIMgM.png"
}
],
"params": [
{
"id": 130,
"component_id": 20,
"name": "Manufacturer",
"slug": "manufacturer",
"order": 1
}
],
"manufacturers": [
{
"id": 3,
"name": "Bendix",
"default": 0
}
],
"parts": [
{
"id": 186128,
"number": "800959",
"name": "DRYER_AIR",
"manufacturer_id": 3,
"manufacturer_name": "Bendix",
"notes": "Has 1\/4\" NPT auxiliary inlet port",
"params": {
"manufacturer": "Bendix",
"style": "AD-IS",
"voltage": "12V",
"wattage": "90W",
"port_size": "1\/2\"",
"purge_valve": "n\/a",
"purge_volume": "Standard",
"new_or_reman": "New",
"with_sc-pr_valve": "No",
"includes_mounting_bracket": "n\/a",
"application": "Chevrolet GMC Kodiak & Topkick C-Models"
},
"accessory": null
}
]
}
}
Received response:
Request failed with error:
Delete part
requires authentication
Delete a part linked to the component
Example request:
const url = new URL(
"/api/component/non/part/7"
);
let headers = {
"X-Authorization": "{api-key}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());
Example response (200):
{
"data": {
"id": 20,
"name": "Air System - Air Dryers",
"notes": null,
"image": "http:\/\/api-truckpartscross.local\/storage\/public\/component_images\/WrJcNEo6Tv9bIw6lyPNrQIZOfOS8kYWJurFMIMgM.png",
"images": [
{
"id": 5,
"url": "http:\/\/api-truckpartscross.local\/storage\/public\/component_images\/WrJcNEo6Tv9bIw6lyPNrQIZOfOS8kYWJurFMIMgM.png",
"path": "public\/component_images\/WrJcNEo6Tv9bIw6lyPNrQIZOfOS8kYWJurFMIMgM.png"
}
],
"params": [
{
"id": 130,
"component_id": 20,
"name": "Manufacturer",
"slug": "manufacturer",
"order": 1
}
],
"manufacturers": [
{
"id": 3,
"name": "Bendix",
"default": 0
}
],
"parts": [
{
"id": 186128,
"number": "800959",
"name": "DRYER_AIR",
"manufacturer_id": 3,
"manufacturer_name": "Bendix",
"notes": "Has 1\/4\" NPT auxiliary inlet port",
"params": {
"manufacturer": "Bendix",
"style": "AD-IS",
"voltage": "12V",
"wattage": "90W",
"port_size": "1\/2\"",
"purge_valve": "n\/a",
"purge_volume": "Standard",
"new_or_reman": "New",
"with_sc-pr_valve": "No",
"includes_mounting_bracket": "n\/a",
"application": "Chevrolet GMC Kodiak & Topkick C-Models"
},
"accessory": null
}
]
}
}
Received response:
Request failed with error:
Detach Manufacturer
requires authentication
Detach all parts of the specified manufacturer from the component
Example request:
const url = new URL(
"/api/component/17/manufacturer/qui"
);
let headers = {
"X-Authorization": "{api-key}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());
Example response (200):
{
"data": {
"id": 20,
"name": "Air System - Air Dryers",
"notes": null,
"image": "http:\/\/api-truckpartscross.local\/storage\/public\/component_images\/WrJcNEo6Tv9bIw6lyPNrQIZOfOS8kYWJurFMIMgM.png",
"images": [
{
"id": 5,
"url": "http:\/\/api-truckpartscross.local\/storage\/public\/component_images\/WrJcNEo6Tv9bIw6lyPNrQIZOfOS8kYWJurFMIMgM.png",
"path": "public\/component_images\/WrJcNEo6Tv9bIw6lyPNrQIZOfOS8kYWJurFMIMgM.png"
}
],
"params": [
{
"id": 130,
"component_id": 20,
"name": "Manufacturer",
"slug": "manufacturer",
"order": 1
}
],
"manufacturers": [
{
"id": 3,
"name": "Bendix",
"default": 0
}
],
"parts": [
{
"id": 186128,
"number": "800959",
"name": "DRYER_AIR",
"manufacturer_id": 3,
"manufacturer_name": "Bendix",
"notes": "Has 1\/4\" NPT auxiliary inlet port",
"params": {
"manufacturer": "Bendix",
"style": "AD-IS",
"voltage": "12V",
"wattage": "90W",
"port_size": "1\/2\"",
"purge_valve": "n\/a",
"purge_volume": "Standard",
"new_or_reman": "New",
"with_sc-pr_valve": "No",
"includes_mounting_bracket": "n\/a",
"application": "Chevrolet GMC Kodiak & Topkick C-Models"
},
"accessory": null
}
]
}
}
Received response:
Request failed with error:
Favorite Parts
List
requires authentication
Retrieve all favorite parts
Example request:
const url = new URL(
"http://api-truckpartscross.local/api/v2/favorite-parts"
);
let params = {
"user_id": "1",
"sort_by": "name",
"sort_dir": "asc",
"page": "13",
"per_page": "20",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"X-Authorization": "{api-key}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
Example response (200):
{
"data": [
{
"id": 1,
"user_id": 1,
"part_id": 710650,
"part": {
"id": 710650,
"name": "Full-Flow Lube Spin-on",
"number": "LF300",
"manufacturer_id": 1166,
"manufacturer_name": "Hastings"
}
}
],
"meta": {
"total": 1,
"found": 1,
"other_query_info": null
}
}
Received response:
Request failed with error:
Create
requires authentication
Create the favorite part
Example request:
const url = new URL(
"http://api-truckpartscross.local/api/v2/favorite-parts"
);
let params = {
"user_id": "17",
"part_id": "7",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"X-Authorization": "{api-key}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());
Example response (200):
{
"data": {
"id": 1,
"user_id": 1,
"part_id": 710650,
"part": {
"id": 710650,
"name": "Full-Flow Lube Spin-on",
"number": "LF300",
"manufacturer_id": 1166,
"manufacturer_name": "Hastings"
}
}
}
Received response:
Request failed with error:
Delete
requires authentication
Delete the favorite part
Example request:
const url = new URL(
"http://api-truckpartscross.local/api/v2/favorite-parts/7"
);
let headers = {
"X-Authorization": "{api-key}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());
Example response (200):
[]
Received response:
Request failed with error:
Parts
Endpoints for parts. If a part is obsolete
it's ignored in the match
endpoint.
List
requires authentication
Get the list of parts.
Example request:
const url = new URL(
"http://api-truckpartscross.local/api/v2/part/search"
);
let params = {
"search": "sit",
"category_id": "16",
"sub_category_id": "1",
"manufacturer_id": "4",
"manufacturer_name": "et",
"number": "ea",
"vmrs": "ratione",
"no_name": "",
"no_xrefs": "",
"no_vmrs": "",
"no_category": "1",
"no_ecommerce": "1",
"opticat_not_matched": "1",
"new_from": "2021-08-01",
"new_to": "2021-08-31",
"sort_by": "manufacturer_name",
"sort_dir": "desc",
"page": "2",
"per_page": "5",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"X-Authorization": "{api-key}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
Example response (200):
{
"data": [
{
"id": 719206,
"sub_category_id": 139,
"category_name": "Filters",
"sub_category_name": "_Default_",
"number": "LF3",
"standardized_number": "LF3",
"name": "By-Pass Lube Spin-on",
"retail": "0.00",
"cost": "0.00",
"image": "",
"image_url": "",
"vmrs": "",
"notes": "",
"manufacturer_name": "Lee",
"manufacturer_website": null,
"manufacturer_phone": null,
"manufacturer_message": null,
"manufacturer_pdf": "",
"obsolete": false
}
],
"meta": {
"total": 1220353,
"found": 2,
"other_query_info": null
}
}
Example response (401):
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
Retrieve a Part
requires authentication
Get a Part and its equivalences.
Example request:
const url = new URL(
"http://api-truckpartscross.local/api/v2/part/9"
);
let headers = {
"X-Authorization": "{api-key}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
Example response (200):
{
"id": 1004203,
"sub_category_id": 114,
"category_name": "Filters",
"sub_category_name": "Lube",
"number": "LF3000",
"standardized_number": "LF3000",
"name": "Lube Filter",
"retail": "0.00",
"cost": "0.00",
"image": "1004203.jpeg",
"image_url": "https:\/\/api-truckpartscross.com\/storage\/parts\/1004203.jpeg",
"vmrs": "",
"notes": "<p>Test note on LF3000<\/p>",
"manufacturer_name": "Cummins Filtration (Fleetguard)",
"manufacturer_website": null,
"manufacturer_phone": null,
"manufacturer_message": null,
"manufacturer_pdf": "",
"manufacturer_id": 4077,
"retail_change_count": 0,
"average_retail": "0.00",
"last_retail_changes": [],
"amazon_url": "https:\/\/www.amazon.com\/gp\/search?ie=UTF8&tag=diesellaptops-20&linkCode=ur2&linkId=25b0a443a8e34cd8f0a34f6885e2a793&camp=1789&creative=9325&index=automotive&keywords=LF3000",
"google_url": "https:\/\/www.google.com\/search?q=LF3000",
"ebay_url": "http:\/\/rover.ebay.com\/rover\/1\/711-53200-19255-0\/1?ff3=4&pub=5575564369&toolid=10001&campid=5338645045&customid=TruckInfo&mpre=https%3A%2F%2Fwww.ebay.com%2Fsch%2Fi.html?_nkw=LF3000",
"obsolete": false
}
Example response (401):
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
Part Cross-References
requires authentication
Retrieve the list of cross-references for the specified part.
Example request:
const url = new URL(
"http://api-truckpartscross.local/api/v2/part/7/equivalences"
);
let params = {
"search": "eveniet",
"manufacturer_id": "ea",
"page": "3",
"per_page": "16",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"X-Authorization": "{api-key}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
Example response (200):
{
"data": [
{
"id": 1272397,
"number": "SG319",
"name": "Oxygen Sensor",
"manufacturer_id": 952,
"manufacturer_name": "Standard Motor Products",
"manufacturer_phone": null,
"manufacturer_website": null,
"manufacturer_message": null,
"automatic": true,
"vmrs": "045-021-000",
"retail": null,
"equivalences_count": 32
}
],
"meta": {
"total": 43,
"found": 43,
"page": 1,
"per_page": 10,
"updates": {
"manufacturer": {
"id": 953,
"name": "Standard Motor Products"
}
}
}
}
Example response (401):
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
Sub Categories
Sub category is represented by 4-6 digits of VMRS code. The same as VMRS Assembly.
List
requires authentication
Get a list of sub categories.
Example request:
const url = new URL(
"http://api-truckpartscross.local/api/v2/sub-category"
);
let params = {
"category_id": "maxime",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"X-Authorization": "{api-key}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
Example response (200):
{
"data": [
{
"id": 1,
"code": "000",
"category_id": 1,
"category_name": "HVAC",
"name": "Cab, Climate Control, Instrumentation, & Aerodynamic Devices Group"
}
]
}
Received response:
Request failed with error:
Tokens
User search statistics
requires authentication
Retrieve the user search statistics.
Example request:
const url = new URL(
"http://api-truckpartscross.local/api/v2/user/repudiandae/history"
);
let headers = {
"X-Authorization": "{api-key}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
Example response (200):
{
"data": [
{
"search": "LF3000",
"date": "2021-08-01"
}
],
"meta": {
"total": 1987654,
"found": 50
}
}
Example response (401):
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
Add part
requires authentication
Add a part to user.
Example request:
const url = new URL(
"http://api-truckpartscross.local/api/v2/user/occaecati/favorites"
);
let params = {
"part_id": "6",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"X-Authorization": "{api-key}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());
Example response (200):
{
"id": 1004203,
"sub_category_id": 114,
"category_name": "Filters",
"sub_category_name": "Lube",
"number": "LF3000",
"standardized_number": "LF3000",
"name": "Lube Filter",
"retail": "0.00",
"cost": "0.00",
"image": "1004203.jpeg",
"image_url": "https:\/\/api-truckpartscross.com\/storage\/parts\/1004203.jpeg",
"vmrs": "",
"notes": "<p>Test note on LF3000<\/p>",
"manufacturer_name": "Cummins Filtration (Fleetguard)",
"manufacturer_website": null,
"manufacturer_phone": null,
"manufacturer_message": null,
"manufacturer_pdf": "",
"manufacturer_id": 4077,
"retail_change_count": 0,
"average_retail": "0.00",
"last_retail_changes": [],
"amazon_url": "https:\/\/www.amazon.com\/gp\/search?ie=UTF8&tag=diesellaptops-20&linkCode=ur2&linkId=25b0a443a8e34cd8f0a34f6885e2a793&camp=1789&creative=9325&index=automotive&keywords=LF3000",
"google_url": "https:\/\/www.google.com\/search?q=LF3000",
"ebay_url": "http:\/\/rover.ebay.com\/rover\/1\/711-53200-19255-0\/1?ff3=4&pub=5575564369&toolid=10001&campid=5338645045&customid=TruckInfo&mpre=https%3A%2F%2Fwww.ebay.com%2Fsch%2Fi.html?_nkw=LF3000",
"obsolete": false
}
Example response (401):
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
List parts
requires authentication
Retrieve a list of user parts.
Example request:
const url = new URL(
"http://api-truckpartscross.local/api/v2/user/occaecati/favorites"
);
let headers = {
"X-Authorization": "{api-key}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
Example response (200):
{
"data": [
{
"id": 719206,
"sub_category_id": 139,
"category_name": "Filters",
"sub_category_name": "_Default_",
"number": "LF3",
"standardized_number": "LF3",
"name": "By-Pass Lube Spin-on",
"retail": "0.00",
"cost": "0.00",
"image": "",
"image_url": "",
"vmrs": "",
"notes": "",
"manufacturer_name": "Lee",
"manufacturer_website": null,
"manufacturer_phone": null,
"manufacturer_message": null,
"manufacturer_pdf": "",
"obsolete": false
}
],
"meta": {
"total": 1220353,
"found": 2,
"other_query_info": null
}
}
Example response (401):
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
Retrieve part
requires authentication
Retrieve the user part.
Example request:
const url = new URL(
"http://api-truckpartscross.local/api/v2/user/reiciendis/favorites/11"
);
let headers = {
"X-Authorization": "{api-key}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
Example response (200):
{
"id": 1004203,
"sub_category_id": 114,
"category_name": "Filters",
"sub_category_name": "Lube",
"number": "LF3000",
"standardized_number": "LF3000",
"name": "Lube Filter",
"retail": "0.00",
"cost": "0.00",
"image": "1004203.jpeg",
"image_url": "https:\/\/api-truckpartscross.com\/storage\/parts\/1004203.jpeg",
"vmrs": "",
"notes": "<p>Test note on LF3000<\/p>",
"manufacturer_name": "Cummins Filtration (Fleetguard)",
"manufacturer_website": null,
"manufacturer_phone": null,
"manufacturer_message": null,
"manufacturer_pdf": "",
"manufacturer_id": 4077,
"retail_change_count": 0,
"average_retail": "0.00",
"last_retail_changes": [],
"amazon_url": "https:\/\/www.amazon.com\/gp\/search?ie=UTF8&tag=diesellaptops-20&linkCode=ur2&linkId=25b0a443a8e34cd8f0a34f6885e2a793&camp=1789&creative=9325&index=automotive&keywords=LF3000",
"google_url": "https:\/\/www.google.com\/search?q=LF3000",
"ebay_url": "http:\/\/rover.ebay.com\/rover\/1\/711-53200-19255-0\/1?ff3=4&pub=5575564369&toolid=10001&campid=5338645045&customid=TruckInfo&mpre=https%3A%2F%2Fwww.ebay.com%2Fsch%2Fi.html?_nkw=LF3000",
"obsolete": false
}
Example response (401):
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
Delete part
requires authentication
delete the part from the user.
Example request:
const url = new URL(
"http://api-truckpartscross.local/api/v2/user/eveniet/favorites/1"
);
let headers = {
"X-Authorization": "{api-key}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());
Example response (200):
[]
Example response (401):
{
"message": "Unauthenticated."
}
Received response:
Request failed with error:
VMRS Component
VMRS component is represented by the last 3 digits of VMRS code.
List of VMRS Components
requires authentication
Get a list of VMRS components.
Example request:
const url = new URL(
"http://api-truckpartscross.local/api/v2/vmrs-component"
);
let params = {
"vmrs_assembly_id": "5",
"sub_category_id": "7",
};
Object.keys(params)
.forEach(key => url.searchParams.append(key, params[key]));
let headers = {
"X-Authorization": "{api-key}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
Example response (200):
{
"data": [
{
"id": 1,
"code": "000",
"sub_category_id": 1,
"sub_category_name": "Cab, Climate Control, Instrumentation, & Aerodynamic Devices Group",
"name": "Cab, Climate Control, Instrumentation, & Aerodynamic Devices Group"
}
]
}
Received response:
Request failed with error: