API Routes
For Users, these are API routes for the GET request methods.
- /api/:type/:id
- /api/:type
And for System Owners like Stores or Websites, there are 2 API routes for the GET request methods, and 1 route for each request method of the following, POST, PUT DELETE.
-
For PUT and DELETE methods:
- /api/:type/:id
-
For POST method:
- /api/:type/
Usage
For the GET method, you can use your browser to get whatever you want!
Or with any script from your favorite programming language, you can use Python requests for example if you want to navigate through the API.
Here are all the available Hardware types in the API:
- CPU
- GPU
- Motherboard
- RAM
- Storage
- PowerSupply
- Case
- Cooler
- Monitor
- Headphone
- Mice
- Keyboard
Usage for the Systems
And for the other requests, POST, PUT, and Delete, that will be of course in your system or website. But if you want to use the other methods separately, you can choose between plenty of tools that will help you make a request. For example, curl in the terminal, or RestMan Chrome Extension, or the Postman application.
Examples
GET
Here are simple demonstrations of using the GET routes:
-
Get all mices
/api/mice/[{"id":125,"imageURL":"https://cdna.pcpartpicker.com/static/forever/images/product/575c76df1ce4d5588c5749e289515e4c.256p.jpg", "manufacturer":"Logitech","name":"Logitech G Pro X Superlight","trackingMethod":"Optical", "connectionType":"Wireless","maximumDPI":"25400","handOrientation":"Right","color":"Black","rating":0,"price":99.99,"stock":0}, {"id":126,"imageURL":"https://cdna.pcpartpicker.com/static/forever/images/product/0041ec7f09c5b96850347e2254991f73.256p.jpg", "manufacturer":"Logitech","name":"Logitech G305 (Black)","trackingMethod":"Optical","connectionType":"Wireless","maximumDPI":"12000", "handOrientation":"Right","color":"Black","rating":0,"price":34.97,"stock":0} .....]
-
Get the Mouse with ID 302
/api/mice/302[{"id":302,"imageURL":"https://cdna.pcpartpicker.com/static/forever/images/product/901be2ebe905621356b89d4ce7ff142f.256p.jpg", "manufacturer":"Logitech","name":"Logitech G305 LIGHTSPEED","trackingMethod":"Optical","connectionType":"Wireless", "maximumDPI":"12000","handOrientation":"Right","color":"Purple","rating":0,"price":29.99,"stock":0}]
-
Get all HyperX Mouses
/api/mice/?name=hyperx[{"id":185,"imageURL":"https://m.media-amazon.com/images/I/41ZiHvROOGL.jpg","manufacturer":"HP","name":"HP HyperX Pulsefire Haste", "trackingMethod":"Optical","connectionType":"Wired","maximumDPI":"16000","handOrientation":"Right","color":"Black","rating":0,"price":39.97,"stock":0}, {"id":216,"imageURL":"https://cdna.pcpartpicker.com/static/forever/images/product/7ec3d99e13b9e17b324d53e507b9b5d9.256p.jpg", "manufacturer":"HP","name":"HP HyperX Pulsefire Core RGB","trackingMethod":"Optical","connectionType":"Wired","maximumDPI":"6200", "handOrientation":"Right","color":"Black","rating":0,"price":20.48,"stock":0} ...]
-
Get all Rams and sort by Prices with descending order
/api/ram?sort=price&order=DESC[{"id":142,"imageURL":"https://cdna.pcpartpicker.com/static/forever/images/product/33813e932dd7993032d89b4ce508aa21.256p.jpg", "manufacturer":"Corsair","name":"Corsair Dominator Platinum 32 GB","speed":"DDR4-2666","modules":"4 x 8GB","pricePerGB":"52.327", "color":"Black / Silver","firstWordLatency":"11.253 ns","casLatency":"15","rating":0,"price":1674.47,"stock":0},{"id":261, "imageURL":"https://cdna.pcpartpicker.com/static/forever/images/product/1f627399671ad03740af8adeebf5d2da.256p.jpg","manufacturer":"Corsair", "name":"Corsair Vengeance RGB Pro 256 GB","speed":"DDR4-3000","modules":"8 x 32GB","pricePerGB":"6.206","color":"Black", "firstWordLatency":"10.667 ns","casLatency":"16","rating":0,"price":1588.72,"stock":0}, {"id":188,"imageURL":"https://cdna.pcpartpicker.com/static/forever/images/product/cb16dd755c1945f035b8ff6240505e67.256p.jpg", "manufacturer":"G.Skill","name":"G.Skill Trident Z Royal 256 GB","speed":"DDR4-3600","modules":"8 x 32GB", "pricePerGB":"5.855","color":"Gold","firstWordLatency":"10 ns","casLatency":"18","rating":0,"price":1499,"stock":0}, ....]
-
Get all the GPUs that are greate than 100$
/api/gpu?filterBy=price&filterType=gt&filterValue=100[{"id":868,"imageURL":"https://cdna.pcpartpicker.com/static/forever/images/product/f9ba4a1f3b5884c73fc1e9c194f0335c.256p.jpg", "manufacturer":"MSI","name":"MSI GT 1030 2GHD4 LP OC","chipset":"GeForce GT 1030 DDR4","memory":"2 GB","coreClock":"1189 MHz", "boostClock":"1430 MHz","color":"Black","length":"150 mm","rating":0,"price":101.73,"stock":0},{"id":974, "imageURL":"https://m.media-amazon.com/images/I/51zovtZXScL.jpg","manufacturer":"MSI","name":"MSI AERO ITX 2GD4 OC","chipset": "GeForce GT 1030 DDR4","memory":"2 GB","coreClock":"1189 MHz","boostClock":"1430 MHz","color":"Black / White","length":"147 mm","rating":0, "price":106.46,"stock":0},{"id":910,"imageURL":"https://cdna.pcpartpicker.com/static/forever/images/product/9dace604dee21c7037db33bf6dd29432.256p.jpg", "manufacturer":"Sparkle","name":"Sparkle ELF","chipset":"Arc A310","memory":"4 GB","coreClock":"1750 MHz","boostClock":"2000 MHz", "color":"Blue / Black","length":"153 mm","rating":0,"price":109.99,"stock":0}, ...]
-
Get the GPU that it's price is 9999$
api/gpu?filterBy=price&filterType=eq&filterValue=9999[{"id":129,"imageURL":"https://cdna.pcpartpicker.com/static/forever/images/product/6ef5b8f1b94982c71019a0d9ac2795e2.256p.jpg", "manufacturer":"PNY","name":"PNY VCNRTX6000ADA-PB","chipset":"RTX 6000 Ada Generation", "memory":"48 GB","coreClock":"915 MHz","boostClock":"2505 MHz","color":"Black / Gold","length":"267 mm","rating":0,"price":9999,"stock":0}]
Here are the options that you can add in the query:
- id
- name
- manufacturer
-
sort
- price
- rate
-
order
- ASC
- DESC
-
filter
-
filterBy
- price
- rate
-
filterType
- gt
- lt
- eq
- filterValue
-
filterBy
You can also apply pagination in the API
-
In /api/:type?... query
-
Start from the 5th product
/api/:type?start=5 -
Get products up to the 10th product
/api/:type?end=10 -
Limit the result to a specific number
/api/:type?limit=20 -
You can combine them all together!
-
Start from the 5th product
-
Or by using a sequence to do it easly:
-
Here is a quick demonstration on how to use the limit parameter:
"usage":["start:n:n", "n:end:n", "n:n:limit", "start:end:n", "start:n:limit" ]
-
Examples
-
Get the 10th case till the 12th case
/api/case?limit=10:12:n
[{"id":134,"imageURL":"https://cdna.pcpartpicker.com/static/forever/images/product/1977a3a3f6f1238d12ea2a555be4d7ce.256p.jpg", "manufacturer":"Fractal Design","name":"Fractal Design North","type":"ATX Mid Tower","color":"Black","powerSupply":"None","sidePanel": "Tempered Glass","externalVolume":"45.1 L","internalBays":"2","rating":0,"price":139.99,"stock":0},{"id":135, "imageURL":"https://cdna.pcpartpicker.com/static/forever/images/product/0610d363ccccf52837f07d811e4eb2a3.256p.jpg","manufacturer":"Corsair", "name":"Corsair iCUE 4000X RGB","type":"ATX Mid Tower", "color":"Black","powerSupply":"None","sidePanel":"Tempered Glass","externalVolume":"48.6 L", "internalBays":"2","rating":0,"price":119.99,"stock":0} ]
-
Get 50 cases only
/api/case?limit=n:n:50 -
Get 50 Rams only starting from the 120th Ram
/api/case?limit=120:n:50
-
-
POST
Using your favorite tool, just make a POST request with this route /api/:type/ and add the header Content-Type with the value application/json and add to the body the Information for the new product.
Usgin curl for example:
($) curl -X POST http://yourwebsite.com/api/case -H "Content-Type: application/json" -d '{"name": "Cooler Master MB511", "manufacturer": "Cooler Master"}' {"id":805}
DELETE
Using your favorite tool, just make a DELETE request with this route /api/:type/:id to delete an item.
Usgin curl for example:
($) curl -X DELETE http://yourwebsite.com/api/case/55 55
PUT
Using your favorite tool, just make a PUT request with this route /api/:type/:id and add the header Content-Type with the value application/json and add to the body the new information you want to update for the product.
Usgin curl for example:
($) curl -X PUT http://localhost:3000/api/case/805 -H "Content-Type: application/json" -d '{"color": "Black"}' [{"id":805,"imageURL":null,"name":"Cooler Master MB511","type":null,"color":"Black","powerSupply":null, "sidePanel":null,"externalVolume":null,"internalBays":null,"manufacturer":"Cooler Master", "rating":null,"price":null,"stock":null}]