This Flask application provides a simple JSON API for managing items stored in a JSON file (data.json
).
Returns a list of items filtered by query parameters.
Query Parameters:
id
: Filters items by ID.name
: Filters items by name.
Updates an item by ID.
Request Body:
{
"id": 1,
"name": "Updated Item Name"
}
Adds a new item.
Request Body:
{
"id": 4,
"name": "New Item"
}
Deletes an item by its ID.
- 400 Bad Request: Missing parameters in request body.
- 404 Not Found: Item with specified ID does not exist.
- 409 Conflict: Item with specified ID already exists (POST operation).
- Clone the repository.
- Install dependencies: pip install -r requirements.txt
- Run the Flask application: python app.py
- Python 3.x
- Flask