API Documentation
REST API for managing users.
API Base URL
https://guilhermebranco.com.br/api/v1/users/
Endpoints
GET /api/v1/users
Retrieve a list of all users.
Response Example:
{
"status": "success",
"data": [
{
"id": 1,
"name": "John Doe",
"email": "john.doe@example.com"
},
{
"id": 2,
"name": "Jane Doe",
"email": "jane.doe@example.com"
}
]
}
Status Codes:
- 200 OK - Request was successful.
- 500 Internal Server Error - Something went wrong on the server.
GET /api/v1/users/{id}
Retrieve a specific user by their ID.
URL Parameters:
id
(required) - The ID of the user to retrieve.
Response Example:
{
"status": "success",
"data": {
"id": 1,
"name": "John Doe",
"email": "john.doe@example.com"
}
}
Status Codes:
- 200 OK - Request was successful.
- 404 Not Found - User not found.
- 500 Internal Server Error - Something went wrong on the server.
POST /api/v1/users
Create a new user.
Request Body:
{
"name": "New User",
"email": "new.user@example.com"
}
Response Example:
{
"status": "success",
"data": {
"id": 3,
"name": "New User",
"email": "new.user@example.com"
}
}
Status Codes:
- 201 Created - User was successfully created.
- 400 Bad Request - Invalid data was provided.
- 500 Internal Server Error - Something went wrong on the server.
PUT /api/v1/users/{id}
Update an existing user.
URL Parameters:
id
(required) - The ID of the user to update.
Request Body:
{
"name": "Updated Name",
"email": "updated.email@example.com"
}
Response Example:
{
"status": "success",
"data": {
"id": 1,
"name": "Updated Name",
"email": "updated.email@example.com"
}
}
Status Codes:
- 200 OK - User was successfully updated.
- 400 Bad Request - Invalid data was provided.
- 404 Not Found - User not found.
- 500 Internal Server Error - Something went wrong on the server.
DELETE /api/v1/users/{id}
Delete a specific user by their ID.
URL Parameters:
id
(required) - The ID of the user to delete.
Response Example:
{
"status": "success",
"message": "User deleted successfully."
}
Status Codes:
- 200 OK - User was successfully deleted.
- 404 Not Found - User not found.
- 500 Internal Server Error - Something went wrong on the server.