This is a REST API with basic CRUD operation. It is built with PHP and MySQL 8.0.30. It is a simple API that can be used to create, read, update and delete 'person' resource.
- Detailed documentation of the API can be found here: API Documentation
Request:
POST /api
Content-Type: application/json
{
"name": "John Doe"
}
Response:
Status: 200 OK
Content-Type: application/json
[
{
"id": 1,
"name": "John Doe"
}
]
Request:
GET /api/{id}
Response:
Status: 200 OK
Content-Type: application/json
{
"id": 1,
"name": "John Doe",
}
Request:
PUT /api/{id}
Content-Type: application/json
{
"name": "Updated User",
}
Response:
Status: 200 OK
Content-Type: application/json
{
"id": 1,
"name": "Updated User"
}
Request:
DELETE /api/{id}
Response:
Status: 204 No Content
Note: Replace {id}
in the URLs with the actual ID of the user you want to retrieve, update, or delete.
The API returns the following in case of an error:
Status: Error Code
Content-Type: application/json
{
"error": "Error Message"
}