Free Simple Mockify API for Testing and Prototyping.
Mockify API is a free online REST API that you can use whenever you need some Mocking data to test things locally.
Let go to API
Mockify API comes with a set of 3 resources:
/users - 10 users
/products - 50 Products
/books - 100 books
| First Header (Optional) | Second Header |
|---|---|
pageNumber |
specify the current page [ default 0 ] |
pageSize |
results per page [ default 10 per page ] |
sortBy |
sort results by a certain field [ default 'id' field ] |
sortDir |
set the sort order to asc or desc [default asc] |
All HTTP methods are supported. You can use http or https for your requests.
-
GET /products
Request :
var requestOptions = { method: 'GET', redirect: 'follow' }; fetch("https://mockify-api.onrender.com/api/v1/products", requestOptions) .then(response => response.text()) .then(result => console.log(result)) .catch(error => console.log('error', error));
Response :
{ "content": [ { "id": 1, "productName": "Intelligent Iron Hat", "material": "Marble", "price": "91.46", "department": "Home, Movies & Sports", "color": "yellow", "promotionCode": "SpecialSavings420226" }, { "id": 2, "productName": "Durable Linen Bag", "material": "Silk", "price": "27.32", "department": "Sports", "color": "maroon", "promotionCode": "AmazingSavings810673" }, { "id": 3, "productName": "Incredible Iron Bottle", "material": "Wool", "price": "74.80", "department": "Movies, Music & Toys", "color": "sky blue", "promotionCode": "CoolPromotion107804" }, { "id": 4, "productName": "Awesome Bronze Watch", "material": "Leather", "price": "12.54", "department": "Computers & Jewelry", "color": "maroon", "promotionCode": "IncrediblePromo545273" }, { "id": 5, "productName": "Fantastic Cotton Lamp", "material": "Linen", "price": "14.43", "department": "Games", "color": "azure", "promotionCode": "KillerCode065452" }, { "id": 6, "productName": "Sleek Rubber Lamp", "material": "Aluminum", "price": "82.63", "department": "Industrial", "color": "sky blue", "promotionCode": "SpecialCode776047" }, { "id": 7, "productName": "Awesome Granite Shoes", "material": "Granite", "price": "77.23", "department": "Electronics & Outdoors", "color": "olive", "promotionCode": "SweetPrice205512" }, { "id": 8, "productName": "Heavy Duty Wooden Wallet", "material": "Rubber", "price": "72.35", "department": "Games", "color": "sky blue", "promotionCode": "SpecialPromotion627361" }, { "id": 9, "productName": "Durable Granite Wallet", "material": "Linen", "price": "28.02", "department": "Baby & Health", "color": "tan", "promotionCode": "PremiumSale626165" }, { "id": 10, "productName": "Awesome Plastic Clock", "material": "Copper", "price": "55.85", "department": "Computers", "color": "silver", "promotionCode": "AwesomeSale344693" } ], "pageNumber": 0, "pageSize": 10, "totalElements": 50, "totalPages": 5, "lastPage": false } -
GET /products/1
Request :
var requestOptions = { method: 'GET', redirect: 'follow' }; fetch("https://mockify-api.onrender.com/api/v1/products/1", requestOptions) .then(response => response.text()) .then(result => console.log(result)) .catch(error => console.log('error', error));
Response :
{ "id": 1, "productName": "Durable Iron Watch", "material": "Marble", "price": "82.17", "department": "Computers & Sports", "color": "orchid", "promotionCode": "SweetPromotion460591" } -
PUT /products/1
Request :
var raw = "{\r\n \"productName\": \"Awesome Paper Bottle\",\r\n \"material\": \"wool\",\r\n \"price\": \"43.72\",\r\n \"department\": \"Baby, Kids & Music\",\r\n \"color\": \"blue\",\r\n \"promotionCode\": \"GoodPromo368049\"\r\n}"; var requestOptions = { method: 'PUT', body: raw, redirect: 'follow' }; fetch("https://mockify-api.onrender.com/api/v1/products/1", requestOptions) .then(response => response.text()) .then(result => console.log(result)) .catch(error => console.log('error', error));
Response :
{ "id": 1, "productName": "Awesome Paper Bottle", "material": "wool", "price": "43.72", "department": "Baby, Kids & Music", "color": "blue", "promotionCode": "GoodPromo368049" } -
DELETE /products/1
Request :
var requestOptions = { method: 'DELETE', redirect: 'follow' }; fetch("https://mockify-api.onrender.com/api/v1/products/2", requestOptions) .then(response => response.text()) .then(result => console.log(result)) .catch(error => console.log('error', error));
Response :
{ "message":"Product with ID : 2 Deleted Successfully." } -
GET (With Parameters) /products/
Request :
var requestOptions = { method: 'GET', redirect: 'follow' }; fetch("https://mockify-api.onrender.com/api/v1/products/?sortBy=productName&sortDir=asc&pageNumber=1&pageSize=5", requestOptions) .then(response => response.text()) .then(result => console.log(result)) .catch(error => console.log('error', error));
Response :
{ "content": [ { "id": 1, "productName": "Intelligent Iron Hat", "material": "Marble", "price": "91.46", "department": "Home, Movies & Sports", "color": "yellow", "promotionCode": "SpecialSavings420226" }, { "id": 2, "productName": "Durable Linen Bag", "material": "Silk", "price": "27.32", "department": "Sports", "color": "maroon", "promotionCode": "AmazingSavings810673" }, { "id": 3, "productName": "Incredible Iron Bottle", "material": "Wool", "price": "74.80", "department": "Movies, Music & Toys", "color": "sky blue", "promotionCode": "CoolPromotion107804" }, { "id": 4, "productName": "Awesome Bronze Watch", "material": "Leather", "price": "12.54", "department": "Computers & Jewelry", "color": "maroon", "promotionCode": "IncrediblePromo545273" }, { "id": 5, "productName": "Fantastic Cotton Lamp", "material": "Linen", "price": "14.43", "department": "Games", "color": "azure", "promotionCode": "KillerCode065452" } ], "pageNumber": 0, "pageSize": 5, "totalElements": 50, "totalPages": 10, "lastPage": false }
Coded and maintained with ❤️ by - @JayramManale © 2022
