Dummy Products API

Provides dummy products to aid you in prototyping or developing e-commerce type of websites.

Get Started

Why Dummy Products API?

As someone who is willing to practice creating e-commerce websites, It is a struggle to find some dummy data as a placeholder while on development stage. I've tried to sign up to all sorts of available e-commerce APIs from known companies, however, some of them has complexity in implementation because their API is used also in production, which includes authorization and such, and some, unfortunately, stopped accepting new accounts to have access from their APIs.


I've tried using Faker js however, I'm not satisfied with the commerce method it offers though I have to admit that faker js is really helpful in some scenarios.


This results to me, thinking of creating an API that mimics the structure of the data in a simpliest way possible, and there goes Dummy Products API 😊

Features

Caveats

Base URL

https://dummyproducts-api.herokuapp.com

Department Routes

Product Routes

Action Routes

Basic Usage

Form the url and append the api key as a query string with key 'apikey'. The 'apikey' is the only required parameter on all routes

        fetch(`${baseurl}/api/v1/products?apikey=XXXXXXXXX`)
                .then(res => res.json())
                .then(data => console.log(data))
        

Filters

Filters are only available to '/products' and '/products/search' routes, and this is only for the mean time while the API is under restructuring since the addidtion of several middlewares.

To apply filters you need to use any of these query string keys 'stocks', 'sales', 'price', and 'ratings' with correct value format and can be chained together.

Filter values should include any one operator 'lt' which stands for 'less than', 'lte' which stands for 'less than or equal to', 'gt' which stands for 'greater than', or 'gte' which stands for 'greater than or equal to'. after the operator, give the value by writing "_" then the value, eg: "lte_25" less than or equal to 25.

If there are multiple filter values against a certain key, separate them using "^"

The query below 'price=gt_500^lt_1500' will respond with all products that has a price greater than 500 and (seperated by ^) less than 1500
        fetch(`${baseurl}/api/v1/products?apikey=XXXXXXXXX&price=gt_500^lt_1500`)
            .then(res => res.json())
            .then(data => console.log(data))
        

Pagination

Pagination is supported on all routes except '/departments' and '/products/:product_id' route. To apply pagination, you need to use the query string keys 'page' and 'limit' though you can use one at a time as well. By default, all routes are limited by 20 results

The query below only uses limit
        fetch(`${baseurl}/api/v1/products?apikey=XXXXXXXXX&limit=5`)
            .then(res => res.json())
            .then(data => console.log(data))
        
The query below uses both limit and page
        fetch(`${baseurl}/api/v1/products?apikey=XXXXXXXXX&limit=5&page=2`)
            .then(res => res.json())
            .then(data => console.log(data))
        

Other Options

Similar Products. This option is available only on /products/:product_id route and all you need to do is to append a query string &similarities=true and this will add a new property to the response 'product_similar', which contains an array of products similar to the queried product with max total of 5. By default /products/:product_id route responds without similar products.

Usage of 'similarities' option
            fetch(`${baseurl}/api/v1/products/5fe131b47aa7711eb3c10216?apikey=XXXXXXXXX&similarities=true`)
                .then(res => res.json())
                .then(data => console.log(data))
            }
        

Start prototyping now!
Grab your API key from your email!