This documentation provides details about available endpoints and how to interact with them.
All API endpoints are relative to:
https://[your-domain]/api
Response will appear here
Returns a list of all items.
Parameter | Type | Description |
---|---|---|
name | string | Filter items by name (optional) |
{
"items": [
{
"id": 1,
"name": "Sample Item",
"description": "This is a sample item in our API",
"created_at": "2023-01-01T12:00:00"
}
],
"count": 1
}
Returns a specific item by ID.
Parameter | Type | Description |
---|---|---|
id | integer | ID of the item to retrieve |
{
"item": {
"id": 1,
"name": "Sample Item",
"description": "This is a sample item in our API",
"created_at": "2023-01-01T12:00:00"
}
}
{
"error": "Item with ID 999 not found"
}
Creates a new item.
Field | Type | Required | Description |
---|---|---|---|
name | string | Yes | Name of the item |
description | string | No | Description of the item |
{
"name": "New Item",
"description": "This is a new item created via the API"
}
{
"message": "Item created successfully",
"item": {
"id": 2,
"name": "New Item",
"description": "This is a new item created via the API",
"created_at": "2023-08-15T14:30:45.123456"
}
}
{
"error": "Name is required"
}
Updates an existing item.
Parameter | Type | Description |
---|---|---|
id | integer | ID of the item to update |
Field | Type | Required | Description |
---|---|---|---|
name | string | No | New name for the item |
description | string | No | New description for the item |
{
"name": "Updated Item Name",
"description": "This item has been updated"
}
{
"message": "Item updated successfully",
"item": {
"id": 1,
"name": "Updated Item Name",
"description": "This item has been updated",
"created_at": "2023-01-01T12:00:00"
}
}
Deletes an item.
Parameter | Type | Description |
---|---|---|
id | integer | ID of the item to delete |
{
"message": "Item with ID 1 deleted successfully"
}
{
"error": "Item with ID 999 not found"
}