Documentation

You can copy paste the code in your browser console to quickly test Store API.

Cart

Get all carts

fetch('STORE_CLIENT_API_BASE_URL/carts')
  .then(response => response.json())
  .then(json => console.log(json))

Get Single Cart

fetch('STORE_CLIENT_API_BASE_URL/carts/6572b9c1f610af2847fcba15')
  .then(response => response.json())
  .then(json => console.log(json))

Add new cart

fetch('STORE_CLIENT_API_BASE_URL/carts',
  {
    method: 'POST',
    body: JSON.stringify({
      "userId": "612e48bf345dcc333ac6cb28",
      "products": [
        {
          "productId": "61ab43350f34753bcedfa7aa",
          "quantity": 5
        },
        {
          "productId": "61ab434b0f34753bcedfa7ae",
          "quantity": 7
        }
      ]
    }),
    headers: {
        'Content-type': 'application/json; charset=UTF-8',
    },
  })
  .then(response => response.json())
  .then(json => console.log(json))

Update cart

fetch('STORE_CLIENT_API_BASE_URL/carts/6572b9c1f610af2847fcba15',
  {
    method: 'PUT',
    body: JSON.stringify({
      "products": [
        { "productId": "61ab42d00f34753bcedfa79e", "quantity": 5 },
        { "productId": "61ab42e90f34753bcedfa7a2", "quantity": 3 }
      ]
    }),
    headers: {
        'Content-type': 'application/json; charset=UTF-8',
    },
  })
  .then(response => response.json())
  .then(json => console.log(json))

Delete cart

fetch('STORE_CLIENT_API_BASE_URL/carts/6572b9c1f610af2847fcba15',
  {
    method: 'DELETE',
  })
  .then(response => response.json())
  .then(json => console.log(json))