API Documentation
Endpoints
- GET /api/v1/clients/ - Retrieves a list of all clients.
- GET /api/v1/trips/ - Retrieves a list of all trips.
- GET /api/v1/all_data/ - Retrieves both clients and trips.
Usage
To fetch data from each endpoint, you can use the following commands:
# Fetch all clients curl -X GET "https://pavlyuk.online/client-management-system/api/v1/clients/" # Fetch all trips curl -X GET "https://pavlyuk.online/client-management-system/api/v1/trips/" # Fetch both clients and trips curl -X GET "https://pavlyuk.online/client-management-system/api/v1/all_data/"
Response Format
The API responses are in JSON format. Here’s an example response from the /clients
endpoint:
HTTP/1.1 200 OK Content-Type: application/json { "clients": [ { "id": 1, "name": "John Doe", "email": "john.doe@example.com" }, { "id": 2, "name": "Jane Smith", "email": "jane.smith@example.com" } ] }
Error Responses
If an error occurs, the API will return an appropriate HTTP status code along with an error message:
HTTP/1.1 404 Not Found Content-Type: application/json { "error": "Resource not found." }
Authorization
Some endpoints may require authorization. Use the following format in your request headers:
Authorization: Bearer {your_token_here}
Replace {your_token_here}
with your actual authorization token.
Note: Make sure to keep your token secure and avoid sharing it publicly.