Skip to content
Mock APIs

Resources

Carts

Shopping carts that reference seeded users and products, with computed totals and discounts. The dataset contains 50 carts.

Read-only resource

Carts can be listed, searched, and fetched by ID. Write methods return 405 Method Not Allowed.

Endpoints

The cart object

Use select to return a subset of these fields. Sort with sortBy on id, userId, total, discountedTotal, totalQuantity; search matches . See query parameters.

cart fields
FieldTypeNotes
idintegermin -9007199254740991, max 9007199254740991
userIdintegermin -9007199254740991, max 9007199254740991
productsobject[]
totalnumber
discountedTotalnumber
totalProductsintegermin -9007199254740991, max 9007199254740991
totalQuantityintegermin -9007199254740991, max 9007199254740991

List carts

GET/api/v1/carts

Returns a paginated list of carts. Supports pagination, field selection, sorting, and filtering.

Parameters

Parameters for List carts
NameInTypeDescription
limitqueryintegerNumber of records to return (1-100).Default: 30Range: 1-100
skipqueryintegerNumber of records to skip before returning results.Default: 0Range: 0-1000000
selectquerystringComma-separated list of fields to return. id is always included. Allowed: id, userId, products, total, discountedTotal, totalProducts, totalQuantity.
sortByquerystringField to sort by.One of: id, userId, total, discountedTotal, totalQuantityDefault: id
orderquerystringSort direction.One of: asc, descDefault: asc
userIdqueryintegerOnly return carts that belong to this user ID.
delayqueryintegerDelay the response by this many milliseconds (0-5000). Subject to a stricter rate limit.Range: 0-5000

Status codes

  • 200A page of carts with total, skip, and limit metadata.
  • 400Invalid path or query parameter (INVALID_PARAMETER / INVALID_ID).
  • 429Too many requests from this IP (RATE_LIMIT_EXCEEDED).
  • 503The database is temporarily unavailable (SERVICE_UNAVAILABLE).

Request

curl 'https://test.naimulhassan.me/api/v1/carts?limit=2'

Example responses

Captured from the real API with the requests shown on this page.

200application/json
{
  "carts": [
    {
      "id": 1,
      "userId": 1,
      "products": [
        {
          "id": 100,
          "title": "Aquaform Kickboard",
          "price": 117.99,
          "quantity": 2,
          "total": 235.98,
          "discountPercentage": 0.09,
          "discountedTotal": 235.77,
          "thumbnail": "https://test.naimulhassan.me/api/v1/images/products/100"
        },
        {
          "id": 7,
          "title": "Orbitel One Smartphone",
          "price": 1192.99,
          "quantity": 2,
          "total": 2385.98,
          "discountPercentage": 13.24,
          "discountedTotal": 2070.08,
          "thumbnail": "https://test.naimulhassan.me/api/v1/images/products/7"
        },
        {
          "id": 49,
          "title": "Lumio Watch Sport Strap",
          "price": 546.99,
          "quantity": 4,
          "total": 2187.96,
          "discountPercentage": 1.02,
          "discountedTotal": 2165.64,
          "thumbnail": "https://test.naimulhassan.me/api/v1/images/products/49"
        }
      ],
      "total": 4809.92,
      "discountedTotal": 4471.49,
      "totalProducts": 3,
      "totalQuantity": 8
    },
    {
      "id": 2,
      "userId": 75,
      "products": [
        {
          "id": 85,
          "title": "Dewdrop Gentle Foaming Cleanser",
          "price": 51.99,
          "quantity": 1,
          "total": 51.99,
          "discountPercentage": 3.93,
          "discountedTotal": 49.95,
          "thumbnail": "https://test.naimulhassan.me/api/v1/images/products/85"
        },
        {
          "id": 16,
          "title": "Arcbook Go 12 Chromebook",
          "price": 1982.99,
          "quantity": 3,
          "total": 5948.97,
          "discountPercentage": 18.14,
          "discountedTotal": 4869.83,
          "thumbnail": "https://test.naimulhassan.me/api/v1/images/products/16"
        }
      ],
      "total": 6000.96,
      "discountedTotal": 4919.78,
      "totalProducts": 2,
      "totalQuantity": 4
    }
  ],
  "total": 50,
  "skip": 0,
  "limit": 2
}

Try it

GET
Headers

No header yet.

Open in playground
Send the request to see a live response.

Get a cart

GET/api/v1/carts/{id}

Returns a single cart by its numeric ID.

Parameters

Parameters for Get a cart
NameInTypeDescription
idrequiredpathintegerNumeric cart ID (positive integer).Min: 1
selectquerystringComma-separated list of fields to return. id is always included. Allowed: id, userId, products, total, discountedTotal, totalProducts, totalQuantity.
delayqueryintegerDelay the response by this many milliseconds (0-5000). Subject to a stricter rate limit.Range: 0-5000

Status codes

  • 200The cart object.
  • 400Invalid path or query parameter (INVALID_PARAMETER / INVALID_ID).
  • 404No record exists with that ID (RESOURCE_NOT_FOUND).

Request

curl 'https://test.naimulhassan.me/api/v1/carts/1'

Example responses

Captured from the real API with the requests shown on this page.

200application/json
{
  "id": 1,
  "userId": 1,
  "products": [
    {
      "id": 100,
      "title": "Aquaform Kickboard",
      "price": 117.99,
      "quantity": 2,
      "total": 235.98,
      "discountPercentage": 0.09,
      "discountedTotal": 235.77,
      "thumbnail": "https://test.naimulhassan.me/api/v1/images/products/100"
    },
    {
      "id": 7,
      "title": "Orbitel One Smartphone",
      "price": 1192.99,
      "quantity": 2,
      "total": 2385.98,
      "discountPercentage": 13.24,
      "discountedTotal": 2070.08,
      "thumbnail": "https://test.naimulhassan.me/api/v1/images/products/7"
    },
    {
      "id": 49,
      "title": "Lumio Watch Sport Strap",
      "price": 546.99,
      "quantity": 4,
      "total": 2187.96,
      "discountPercentage": 1.02,
      "discountedTotal": 2165.64,
      "thumbnail": "https://test.naimulhassan.me/api/v1/images/products/49"
    }
  ],
  "total": 4809.92,
  "discountedTotal": 4471.49,
  "totalProducts": 3,
  "totalQuantity": 8
}

Try it

GET
Headers

No header yet.

Open in playground
Send the request to see a live response.