Gen-Endpoint
Back to API List
Product Catalog API
API for browsing and managing a product catalog.
E-commerce
Internal API - Hosted by this App
API Endpoints & Usage
Explore and interact with the available endpoints for the Product Catalog API. These API routes are live! The paths shown below are relative to your application's base URL. For example, if this application is hosted at https://gen-endpoint.com, an endpoint path for this API, such as /api/products, would be accessible at https://gen-endpoint.com/api/products. You can use the "Try it out" section for each endpoint or use tools like curl, Postman, or your browser's address bar (for GET requests) to interact with them.
GET

/api/products

Retrieves a list of products. Supports optional query parameters for filtering (e.g., `?category=electronics&inStock=true`) and `limit` to control the number of products returned (e.g., `?limit=1`). If no limit is provided, all products are returned (up to the total of 25 mock products).

Show Static Examples

Example Request Parameters:

Path: /api/products?category=Books&limit=1

Example Response:

[
  {
    "id": "prod_123",
    "name": "The Pragmatic Programmer",
    "category": "Books",
    "price": 29.99,
    "stock": 150,
    "imageUrl": "https://placehold.co/300x200.png",
    "description": "From journeyman to master.",
    "details": {
      "pages": 352,
      "author": "David Thomas, Andrew Hunt"
    },
    "reviews": [
      {
        "rating": 5,
        "comment": "A must-read!"
      }
    ]
  }
]
Try it out

You can add or change query parameters in the path above (e.g., ?name=User).

GET

/api/products/{productId}

Retrieves details for a specific product by ID. Replace {productId} with an ID like `prod_123`.

Show Static Examples

Example Response:

{
  "id": "prod_123",
  "name": "The Pragmatic Programmer",
  "category": "Books",
  "price": 29.99,
  "stock": 150,
  "imageUrl": "https://placehold.co/300x200.png",
  "description": "From journeyman to master.",
  "details": {
    "pages": 352,
    "author": "David Thomas, Andrew Hunt"
  },
  "reviews": [
    {
      "rating": 5,
      "comment": "A must-read!"
    }
  ]
}
Try it out

Replace placeholders (e.g., {userId}) with actual values in the path above. You can also add/edit query parameters (e.g., ?key=value).

POST

/api/products

Adds a new product to the catalog (Admin only).

Show Static Examples

Example Request Body:

{
  "name": "Ergonomic Mechanical Keyboard",
  "category": "Electronics",
  "price": 159.99,
  "stock": 50,
  "imageUrl": "https://placehold.co/300x200.png",
  "description": "Clicky and comfortable."
}

Example Response:

{
  "id": "prod_789",
  "name": "Ergonomic Mechanical Keyboard",
  "category": "Electronics",
  "price": 159.99,
  "stock": 50,
  "imageUrl": "https://placehold.co/300x200.png",
  "description": "Clicky and comfortable.",
  "createdAt": "2024-08-16T16:00:00Z"
}
Try it out