This API allows you to manage Ferrari and Ford car data. Below are the available endpoints for creating, reading, updating, and deleting Ferrari cars from the database.
All examples are set up for Ferrari but to get Ford data just type ford in the place of Ferrari
https://three41-final.onrender.com
https://three41-final.onrender.com/api-docs
- URL:
/api/ferrari - Method:
GET - Description: Retrieves a list of all Ferrari cars from the database.
- Response:
- 200: Successfully retrieved the list of Ferraris.
- 500: Error retrieving Ferraris.
Example Response:
[
{
"_id": "60a7b4f65f627b1784c9b2a6",
"model": "Ferrari 488 GTB",
"year": 2024,
"engine": "3.9L V8",
"horsepower": 661,
"top_speed": "205 mph",
"image": "https://example.com/ferrari_488_gtb.jpg"
}
]
- URL:
/api/ferrari/:id - Method:
GET - Description: Retrieves details of a specific Ferrari by its ID.
- Response:
- 200: Ferrari found and returned successfully.
- 404: Ferrari not found.
- 500: Error retrieving the Ferrari.
Example Response:
{
"_id": "60a7b4f65f627b1784c9b2a6",
"model": "Ferrari 488 GTB",
"year": 2024,
"engine": "3.9L V8",
"horsepower": 661,
"top_speed": "205 mph",
"image": "https://example.com/ferrari_488_gtb.jpg"
}
- URL:
/api/ferrari - Method:
POST - Description: Adds a new Ferrari to the database.
- Request Body:
{
"model": "Ferrari 488 GTB",
"year": 2024,
"engine": "3.9L V8",
"horsepower": 661,
"top_speed": "205 mph",
"image": "https://example.com/ferrari_488_gtb.jpg"
}
- Response:
- 201: Ferrari created successfully.
- 500: Error creating the Ferrari.
Example Response:
{
"message": "Ferrari created successfully"
}
- URL:
/api/ferrari/:id - Method:
PUT - Description: Updates the details of an existing Ferrari by its ID.
- Request Body:
{
"model": "Ferrari 488 GTB",
"year": 2024,
"engine": "3.9L V8",
"horsepower": 661,
"top_speed": "205 mph",
"image": "https://example.com/ferrari_488_gtb.jpg"
}
- Response:
- 200: Ferrari updated successfully.
- 404: Ferrari not found or no changes made.
- 500: Error updating the Ferrari.
Example Response:
{
"message": "Ferrari updated successfully"
}
- URL:
/api/ferrari/:id - Method:
DELETE - Description: Deletes a specific Ferrari by its ID.
- Response:
- 200: Ferrari deleted successfully.
- 404: Ferrari not found.
- 500: Error deleting the Ferrari.
Example Response:
{
"message": "Ferrari deleted successfully"
}
Tiffany Voorhees & Luke Briggs & Jonathan Aloya