Introduction to Fake Store API — dummy data for your shopping web application

MohammadReza Keikaavousi
2 min readApr 4, 2020

--

It must have happened to you that you want to design a shopping website or web application or in tutorials, you want some fake data to put in your prototype.

Also, you know Lorem Epsom is used over the years, but it isn’t efficient for shopping websites. because you need some data like image, category, price and etc, which isn’t included in lorem ipsum data.

What did we do before?

Imagine that you want to fetch data from external resources to your React or Vue web application. the first thing that comes to our mind is to create a JSON file and write our own shopping dummy data. then fetch these data in our application for the test.

this process is very time-consuming because you need to find pictures, write lots of descriptions from lorem ipsum also! and at the end, you have some fake lorem ipsum data which is not like any other shopping website you viewed before!

Also, Jsonplaceholder doesn’t have any shopping API yet.

so, what should I do now?!

FakeStoreAPI comes to solve this problem! this website helps you to skip this concern and focus on your design. This provides you these resources:

  • products
  • carts
  • users

also, it supports all types of HTTP methods (GET, POST, PUT, PATCH, DELETE) and you can access it with any type of project.

methods other than ‘GET’ make it possible to use this service when you developing an admin panel or CMS for your shopping web application. because for example you can post a new product or create a new user without inserting any real data to the database and get a response from the server! awesome!

Routes that FakeStoreApi provides:

GET:

  • /products (get all products)
  • /products/1 (get specific product based on id)
  • /products?limit=5 (limit return results )
  • /products?sort=desc (asc|desc get products in ascending or descending orders (default to asc))
  • /products/category/jewelery (get all products in specific category)
  • /products/category/jewelery?sort=desc (asc|desc get products in ascending or descending orders (default to asc))
  • /carts (get all carts)
  • /carts/1 (get specific cart based on id)
  • /carts?startdate=2020–10–03&enddate=2020–12–12 (get carts in date range)
  • /carts/user/1 (get a user cart)
  • /carts/user/1?startdate=2020–10–03&enddate=2020–12–12 (get user carts in date range)
  • /carts?limit=5 (limit return results )
  • /carts?sort=desc (asc|desc get carts in ascending or descending orders (default to asc))
  • /users (get all users)
  • /users/1 (get specific user based on id)
  • /users?limit=5 (limit return results )
  • /users?sort=desc (asc|desc get users in ascending or descending orders (default to asc))

POST:

  • /products
  • /carts
  • /users

PUT, PATCH:

  • /products/1
  • /carts/1
  • /users/1

DELETE:

  • /products/1
  • /carts/1
  • /users/1

for example, you can get all products with this simple code below:

fetch('https://fakestoreapi.com/products').then(res=>res.json()).then(json=>console.log(json))

you can read more details in project website or project GitHub page .

please let me know if there is any problem or need more features.

enjoy it! :)

--

--

Responses (1)