Sample Products – Mock REST API for Practice

Updated: March 27, 2023 By: Khue Post a comment

This public, open REST API provides data about 1000 fictional products for learning and testing purposes. You can use it to learn frontend web programming, develop mobile apps, learn to make HTTP requests, or make prototypes or demos for new ideas:

https://api.slingacademy.com/v1/sample-data/products

Parameters

There are 2 optional parameters that can be used for pagination:

ParameterDescription
offsetDetermines whether to start returning data. The default value is 0
limitThis limits the number of results (for better performance and speed). The default value is 10

For example, you can send a GET request to the following API endpoint to get 20 products (starting from the 6th):

https://api.slingacademy.com/v1/sample-data/products?offset=5&limit=20

Data Structure

The response is in JSON format. Each product contains several fields, including id, name, description, price, category, photo_url, created_at, and updated_at. Note that they are meaningless and may seem ridiculous. Don’t use them for serious things:

{
  "success": true,
  "message": "products fetched successfully",
  "offset": 0,
  "limit": 10,
  "products": [
    {
      "photo_url": "https://api.slingacademy.com/public/sample-products/1.png",
      "description": "Others few us role set.",
      "id": 1,
      "created_at": "2023-03-03T13:57:09.399076",
      "updated_at": "2023-03-03T13:57:09.399080",
      "name": "Product 1",
      "price": 778.69,
      "category": "physical"
    },
    {
      "photo_url": "https://api.slingacademy.com/public/sample-products/2.png",
      "description": "Civil field respond drop huge risk wall sign.",
      "id": 2,
      "created_at": "2023-03-03T13:57:09.399081",
      "updated_at": "2023-03-03T13:57:09.399082",
      "name": "Product 2",
      "price": 908.8,
      "category": "physical"
    },
    {
      "photo_url": "https://api.slingacademy.com/public/sample-products/3.png",
      "description": "Available space build policy people model treatment.",
      "id": 3,
      "created_at": "2023-03-03T13:57:09.399082",
      "updated_at": "2023-03-03T13:57:09.399083",
      "name": "Product 3",
      "price": 57.91,
      "category": "digital"
    },
    {
      "photo_url": "https://api.slingacademy.com/public/sample-products/4.png",
      "description": "Hard use always term fire.",
      "id": 4,
      "created_at": "2023-03-03T13:57:09.399083",
      "updated_at": "2023-03-03T13:57:09.399084",
      "name": "Product 4",
      "price": 618.73,
      "category": "physical"
    },
    {
      "photo_url": "https://api.slingacademy.com/public/sample-products/5.png",
      "description": "Rather him lay why.",
      "id": 5,
      "created_at": "2023-03-03T13:57:09.399084",
      "updated_at": "2023-03-03T13:57:09.399085",
      "name": "Product 5",
      "price": 247.98,
      "category": "physical"
    },
    {
      "photo_url": "https://api.slingacademy.com/public/sample-products/6.png",
      "description": "Actually system increase.",
      "id": 6,
      "created_at": "2023-03-03T13:57:09.399085",
      "updated_at": "2023-03-03T13:57:09.399086",
      "name": "Product 6",
      "price": 354.24,
      "category": "digital"
    },
    {
      "photo_url": "https://api.slingacademy.com/public/sample-products/7.png",
      "description": "Machine daughter project peace leave loss.",
      "id": 7,
      "created_at": "2023-03-03T13:57:09.399087",
      "updated_at": "2023-03-03T13:57:09.399087",
      "name": "Product 7",
      "price": 653.12,
      "category": "digital"
    },
    {
      "photo_url": "https://api.slingacademy.com/public/sample-products/8.png",
      "description": "Realize street anything piece south yard since well.",
      "id": 8,
      "created_at": "2023-03-03T13:57:09.399087",
      "updated_at": "2023-03-03T13:57:09.399088",
      "name": "Product 8",
      "price": 522.45,
      "category": "physical"
    },
    {
      "photo_url": "https://api.slingacademy.com/public/sample-products/9.png",
      "description": "School economy respond people.",
      "id": 9,
      "created_at": "2023-03-03T13:57:09.399088",
      "updated_at": "2023-03-03T13:57:09.399089",
      "name": "Product 9",
      "price": 244.9,
      "category": "physical"
    },
    {
      "photo_url": "https://api.slingacademy.com/public/sample-products/10.png",
      "description": "Table husband only painting daughter.",
      "id": 10,
      "created_at": "2023-03-03T13:57:09.399089",
      "updated_at": "2023-03-03T13:57:09.399090",
      "name": "Product 10",
      "price": 375.8,
      "category": "digital"
    }
  ]
}

The size of a product photo is 800 x 600:

Get a Single Product by ID

To retrieve a single product by id, use this route:

https://api.slingacademy.com/v1/sample-data/photos/[product id]

For example, if you fetch a product with the id of 1, the result will be like this:

{
  success: true,
  message: 'product fetched successfully',
  product: {
    name: 'Product 1',
    price: 778.69,
    category: 'physical',
    updated_at: '2023-03-03T13:57:09.399080',
    description: 'Others few us role set.',
    id: 1,
    photo_url: 'https://api.slingacademy.com/public/sample-products/1.png',
    created_at: '2023-03-03T13:57:09.399076'
  }
}

Hope this helps. If you find any bugs or have any questions, please leave a comment. We’re more than happy to hear from you. Happy coding & have a nice day!