Public
Documentation Settings

04-Store-API

The StoreAPI is simple REST API to fetch products from the database according to fiters.

GETHome

https://storeapi-hjc5.onrender.com/

Get the Home Page

Example Request
curl
curl --location 'https://storeapi-hjc5.onrender.com/'
200 OK
Example Response
html
<h1>Store API </h1>
<a href='/api/v1/products'>products</a>
Date

Sat, 01 Apr 2023 10:18:27 GMT

Content-Type

text/html; charset=utf-8

Transfer-Encoding

chunked

Connection

keep-alive

CF-Ray

7b101689bc70e626-DEL

ETag

W/"3b-D5tuhb8DpUSTlZW+O4UnBUq36+k"

Vary

Accept-Encoding

CF-Cache-Status

DYNAMIC

x-powered-by

Express

x-render-origin-server

Render

Server

cloudflare

Content-Encoding

br

alt-svc

h3=":443"; ma=86400, h3-29=":443"; ma=86400

GETproducts static

https://storeapi-hjc5.onrender.com/api/v1/products/static

Get All Products

Example Request
curl
curl --location 'https://storeapi-hjc5.onrender.com/api/v1/products/static'
200 OK
Example Response
json
{
  "products": [
    {
      "_id": "640aacd7abb8c1c8f1ef3678",
      "name": "albany sectional",
      "price": 109
    },
    {
      "_id": "640aacd7abb8c1c8f1ef3679",
      "name": "albany table",
      "price": 309
    },
    {
      "_id": "640aacd7abb8c1c8f1ef367a",
      "name": "armchair",
      "price": 125
    },
    {
      "_id": "640aacd7abb8c1c8f1ef3684",
      "name": "simple chair",
      "price": 109
    },
    {
      "_id": "640aacd7abb8c1c8f1ef3685",
      "name": "sofa set",
      "price": 129
    },
    {
      "_id": "640aacd7abb8c1c8f1ef3688",
      "name": "vase table",
      "price": 120
    }
  ],
  "nbHits": 6
}
Date

Sat, 01 Apr 2023 10:18:44 GMT

Content-Type

application/json; charset=utf-8

Transfer-Encoding

chunked

Connection

keep-alive

CF-Ray

7b1016f5ce2fe626-DEL

ETag

W/"1b1-UZ+PiI+H8tPQfeLYEg9aWXF/l5I"

Vary

Accept-Encoding

CF-Cache-Status

DYNAMIC

x-powered-by

Express

x-render-origin-server

Render

Server

cloudflare

Content-Encoding

br

alt-svc

h3=":443"; ma=86400, h3-29=":443"; ma=86400

GETget products

https://storeapi-hjc5.onrender.com/api/v1/products?numericFilters=price>=100

Get products as per fiter

Available Query Parameters:

Query ParameterValue
nameGet product by its name
featuredGet products by its featured value
companyGet products by company name
sortSort the fetched data by the attribute say "name", "company",etc
fieldsGet only specified fields in the fetched data
limitGet limited fetched data
pageAdd paging according to value specified
numericFiltersGet response filered by numerics filters such as price greater than 500
PARAMS
name

chair

featured

false

company

liddy

sort

name

fields

name,price

limit

2

page

2

numericFilters

price>=100

Example Request
curl
curl --location 'https://storeapi-hjc5.onrender.com/api/v1/products?numericFilters=price%3E%3D100'
200 OK
Example Response
json
{
  "products": [
    {
      "_id": "640aacd7abb8c1c8f1ef3678",
      "name": "albany sectional",
      "price": 109,
      "featured": false,
      "rating": 5,
      "createdAt": "2023-03-10T04:06:45.961Z",
      "company": "liddy",
      "__v": 0
    },
    {
      "_id": "640aacd7abb8c1c8f1ef3684",
      "name": "simple chair",
      "price": 109,
      "featured": false,
      "rating": 4.5,
      "createdAt": "2023-03-10T04:06:45.961Z",
      "company": "liddy",
      "__v": 0
    },
    {
      "_id": "640aacd7abb8c1c8f1ef3685",
      "name": "sofa set",
      "price": 129,
      "featured": false,
      "rating": 4.5,
      "createdAt": "2023-03-10T04:06:45.961Z",
      "company": "marcos",
      "__v": 0
    },
    {
      "_id": "640aacd7abb8c1c8f1ef3688",
      "name": "vase table",
      "price": 120,
      "featured": true,
      "rating": 4.5,
      "createdAt": "2023-03-10T04:06:45.961Z",
      "company": "marcos",
      "__v": 0
    },
    {
      "_id": "640aacd7abb8c1c8f1ef3679",
      "name": "albany table",
      "price": 309,
      "featured": false,
      "rating": 4.9,
      "createdAt": "2023-03-10T04:06:45.961Z",
      "company": "liddy",
      "__v": 0
    },
    {
      "_id": "640aacd7abb8c1c8f1ef367a",
      "name": "armchair",
      "price": 125,
      "featured": false,
      "rating": 4.8,
      "createdAt": "2023-03-10T04:06:45.961Z",
      "company": "marcos",
      "__v": 0
    }
  ],
  "nbHits": 6
}
Date

Sat, 01 Apr 2023 10:19:07 GMT

Content-Type

application/json; charset=utf-8

Transfer-Encoding

chunked

Connection

keep-alive

CF-Ray

7b101788fe62e626-DEL

ETag

W/"3eb-YRF1NSrV7JYywWGHGjZUiXuPgSY"

Vary

Accept-Encoding

CF-Cache-Status

DYNAMIC

x-powered-by

Express

x-render-origin-server

Render

Server

cloudflare

Content-Encoding

br

alt-svc

h3=":443"; ma=86400, h3-29=":443"; ma=86400