Products - thanhle1547/DummyJSON GitHub Wiki

Products - Docs

The products endpoint provides a comprehensive dataset of sample product information, including details like names, prices, descriptions, images, and categories, ideal for testing and prototyping e-commerce applications.

Get all products

By default you will get 30 items, use Limit and skip to paginate through all items.

/products
Response
{
  "products": [
    {
      "id": 1,
      "title": "Essence Mascara Lash Princess",
      "description": "The Essence Mascara Lash Princess is a popular mascara known for its volumizing and lengthening effects. Achieve dramatic lashes with this long-lasting and cruelty-free formula.",
      "category": "beauty",
      "price": 9.99,
      "discountPercentage": 7.17,
      "rating": 4.94,
      "stock": 5,
      "tags": [
        "beauty",
        "mascara"
      ],
      "brand": "Essence",
      "sku": "RCH45Q1A",
      "weight": 2,
      "dimensions": {
        "width": 23.17,
        "height": 14.43,
        "depth": 28.01
      },
      "warrantyInformation": "1 month warranty",
      "shippingInformation": "Ships in 1 month",
      "availabilityStatus": "Low Stock",
      "reviews": [
        {
          "rating": 2,
          "comment": "Very unhappy with my purchase!",
          "date": "2024-05-23T08:56:21.618Z",
          "reviewerName": "John Doe",
          "reviewerEmail": "[email protected]"
        },
        {
          "rating": 2,
          "comment": "Not as described!",
          "date": "2024-05-23T08:56:21.618Z",
          "reviewerName": "Nolan Gonzalez",
          "reviewerEmail": "[email protected]"
        },
        {
          "rating": 5,
          "comment": "Very satisfied!",
          "date": "2024-05-23T08:56:21.618Z",
          "reviewerName": "Scarlett Wright",
          "reviewerEmail": "[email protected]"
        }
      ],
      "returnPolicy": "30 days return policy",
      "minimumOrderQuantity": 24,
      "meta": {
        "createdAt": "2024-05-23T08:56:21.618Z",
        "updatedAt": "2024-05-23T08:56:21.618Z",
        "barcode": "9164035109868",
        "qrCode": "..."
      },
      "thumbnail": "...",
      "images": ["...", "...", "..."]
    },
    {...},
    {...},
    {...}
    // 30 items
  ],
  "total": 194,
  "skip": 0,
  "limit": 30
}

Get a single product

/products/:id

Example:

/products/1
Response
{
  "id": 1,
  "title": "Essence Mascara Lash Princess",
  "description": "The Essence Mascara Lash Princess is a popular mascara known for its volumizing and lengthening effects. Achieve dramatic lashes with this long-lasting and cruelty-free formula.",
  "category": "beauty",
  "price": 9.99,
  "discountPercentage": 7.17,
  "rating": 4.94,
  "stock": 5,
  "tags": [
    "beauty",
    "mascara"
  ],
  "brand": "Essence",
  "sku": "RCH45Q1A",
  "weight": 2,
  "dimensions": {
    "width": 23.17,
    "height": 14.43,
    "depth": 28.01
  },
  "warrantyInformation": "1 month warranty",
  "shippingInformation": "Ships in 1 month",
  "availabilityStatus": "Low Stock",
  "reviews": [
    {
      "rating": 2,
      "comment": "Very unhappy with my purchase!",
      "date": "2024-05-23T08:56:21.618Z",
      "reviewerName": "John Doe",
      "reviewerEmail": "[email protected]"
    },
    {
      "rating": 2,
      "comment": "Not as described!",
      "date": "2024-05-23T08:56:21.618Z",
      "reviewerName": "Nolan Gonzalez",
      "reviewerEmail": "[email protected]"
    },
    {
      "rating": 5,
      "comment": "Very satisfied!",
      "date": "2024-05-23T08:56:21.618Z",
      "reviewerName": "Scarlett Wright",
      "reviewerEmail": "[email protected]"
    }
  ],
  "returnPolicy": "30 days return policy",
  "minimumOrderQuantity": 24,
  "meta": {
    "createdAt": "2024-05-23T08:56:21.618Z",
    "updatedAt": "2024-05-23T08:56:21.618Z",
    "barcode": "9164035109868",
    "qrCode": "..."
  },
  "thumbnail": "...",
  "images": ["...", "...", "..."]
}

Search products

/products/search?q=phone
Response
{
  "products": [
    {
      "id": 101,
      "title": "title": "Apple AirPods Max Silver",
      "category": "mobile-accessories"
      ...
    },
    {...},
    {...},
    {...}
    // 23 results
  ],
  "total": 23,
  "skip": 0,
  "limit": 23
}

Limit and skip products

💡 You can pass limit and skip params to limit and skip the results for pagination, and use limit=0 to get all items.

💡 You can pass select as query params with comma-separated values to select specific data

/products?limit=10&skip=10&select=title,price
Response
{
  "products": [
    {
      "id": 11, // first 10 items are skipped
      "title": "Annibale Colombo Bed",
      "price": 1899.99
    },
    {...},
    {...},
    {...}
    // 10 items
  ],
  "total": 194,
  "skip": 10,
  "limit": 10
}

Sort products

💡 You can pass sortBy and order params to sort the results, sortBy should be field name and order should be "asc" or "desc"

/products?sortBy=title&order=asc
Response
{
  "products": [
    {
      "id": 167,
      "title": "300 Touring", // sorted by title in ascending order
      "price": 28999.99
      /* rest product data */
    },
    {
      "id": 99,
      "title": "Amazon Echo Plus", // sorted by title in ascending order
      "price": 99.99
      /* rest product data */
    },
    {...}
    // 30 items
  ],
  "total": 194,
  "skip": 0,
  "limit": 30
}

Filter products

💡 You can pass price param to filter the results, price should be follow the pattern <from>-<to>.

/products?price=20-70
Response
{
  "products": [
    {
      "id": 6,
      "title": "Calvin Klein CK One",
      "price": 49.99,
      /* rest product data */
    },
    {
      "id": 44,
      "title": "Family Tree Photo Frame",
      "price": 29.99,
      /* rest product data */
    },
    {...}
    // 30 items
  ],
  "total": 194,
  "skip": 0,
  "limit": 30
}

💡 You can omit to to filter the products from a specific price.

/products?price=20-

💡 The dash-separated is optional when you need to filter the products from a specific price.

/products?price=20
Response
{
  "products": [
    {
      "id": 6,
      "title": "Calvin Klein CK One",
      "price": 49.99,
      /* rest product data */
    },
    {
      "id": 44,
      "title": "Family Tree Photo Frame",
      "price": 29.99,
      /* rest product data */
    },
    {...}
    // 30 items
  ],
  "total": 194,
  "skip": 0,
  "limit": 30
}

💡 You can omit from to filter the products have lower price.

💡 The leading dash is required when you need to filter the products have lower price.

/products?price=-70
Response
{
  "products": [
    {
      "id": 1,
      "title": "Essence Mascara Lash Princess",
      "price": 9.99,
      /* rest product data */
    },
    {
      "id": 2,
      "title": "Eyeshadow Palette with Mirror",
      "price": 19.99,
      /* rest product data */
    },
    {...}
    // 30 items
  ],
  "total": 194,
  "skip": 0,
  "limit": 30
}

Get all products categories

/products/categories
Response
[
  {
    "slug": "beauty",
    "name": "Beauty",
    "url": "https://dummyjson.com/products/category/beauty"
  },
  {
    "slug": "fragrances",
    "name": "Fragrances",
    "url": "https://dummyjson.com/products/category/fragrances"
  },
  {
    "slug": "furniture",
    "name": "Furniture",
    "url": "https://dummyjson.com/products/category/furniture"
  },
  {...},
  {...},
  {...}
  // more items
]

Get products category list

/products/category-list
Response
[
  "beauty",
  "fragrances",
  "furniture",
  "groceries",
  "home-decoration",
  "kitchen-accessories",
  "laptops",
  "mens-shirts",
  "mens-shoes",
  "mens-watches",
  "mobile-accessories",
  "motorcycle",
  "skin-care",
  "smartphones",
  "sports-accessories",
  "sunglasses",
  "tablets",
  "tops",
  "vehicle",
  "womens-bags",
  "womens-dresses",
  "womens-jewellery",
  "womens-shoes",
  "womens-watches"
]

Get products by a category

/category/:category

Example:

/category/smartphones
Response
{
  "products": [
    {
      "id": 122,
      "title": "iPhone 6",
      "category": "smartphones",
      ...
    },
    {...}
    // 16 items
  ],
  "total": 16,
  "skip": 0,
  "limit": 16
}
⚠️ **GitHub.com Fallback** ⚠️