A JSON REST API for Testing
I created this JSON API for testing HTTP requests from front-end and back-end web apps that are in development.
It supports GET, POST, PUT, PATCH and DELETE HTTP requests.
POST requests return the contents of the request body plus a random id
property and createdAt
date.
PUT and PATCH requests return the contents of the request body plus an updatedAt
date property.
Product Routes
Below are the supported requests and responses for the /products
path.
Get all products
GET
- https://testapi.jasonwatmore.com/products
JSON Response
[
{
"id": 1,
"name": "Commodore 64"
},
{
"id": 2,
"name": "Atari 2600"
},
{
"id": 3,
"name": "Sega Master System"
},
{
"id": 4,
"name": "Super Nintendo"
}
]
Get product by ID
GET
- https://testapi.jasonwatmore.com/products/1
JSON Response
{
"id": 1,
"name": "Commodore 64"
}
Create product
POST
- https://testapi.jasonwatmore.com/products
Request Body
{
"name": "Amiga 1000",
"price": "3.99"
}
JSON Response
{
"name": "Amiga 1000",
"price": "3.99",
"id": 546,
"createdAt": "2023-01-24T05:57:55.2270899Z"
}
Update product
PUT/PATCH
- https://testapi.jasonwatmore.com/products/1
Request Body
{
"name": "Amiga 1000",
"price": "3.99"
}
JSON Response
{
"name": "Amiga 1000",
"price": "3.99",
"id": 1,
"updatedAt": "2023-01-24T06:02:54.5126881Z"
}
Delete product
DELETE
- https://testapi.jasonwatmore.com/products/1
JSON Response
{
"message": "Product deleted"
}