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./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`).
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!"
}
],
"createdAt": "2024-01-10T10:00:00Z"
}
]
You can add or change query parameters in the path above (e.g., ?name=User).
/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!"
}
],
"createdAt": "2024-01-10T10:00:00Z"
}
Replace placeholders (e.g., {userId}) with actual values in the path above. You can also add/edit query parameters (e.g., ?key=value).
/api/products
Adds a new product to the catalog.
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_new",
"name": "Ergonomic Mechanical Keyboard",
"category": "Electronics",
"price": 159.99,
"stock": 50,
"imageUrl": "https://placehold.co/300x200.png",
"description": "Clicky and comfortable.",
"details": {},
"reviews": [],
"createdAt": "2024-08-16T16:00:00Z"
}
/api/products/{productId}
Updates an existing product by ID. Replace {productId} with an ID like `prod_123`.
Show Static Examples
Example Request Body:
{
"price": 149.99,
"stock": 45
}
Example Response:
{
"id": "prod_123",
"name": "Ergonomic Mechanical Keyboard",
"category": "Electronics",
"price": 149.99,
"stock": 45,
"imageUrl": "https://placehold.co/300x200.png",
"description": "Clicky and comfortable.",
"createdAt": "2024-01-12T12:00:00Z",
"updatedAt": "2024-08-16T16:30:00Z"
}
Replace placeholders (e.g., {userId}) with actual values in the path above.
/api/products/{productId}
Deletes a product by ID. Replace {productId} with an ID like `prod_456`.
Show Static Examples
Example Response:
{
"message": "Product prod_456 deleted successfully.",
"timestamp": "2024-08-16T17:00:00Z"
}
Replace placeholders (e.g., {userId}) with actual values in the path above.