HTTP requests - larbadge/Onl3 GitHub Wiki
Endpoints
Create Car
Create a car with the fields make, color, price. In response, the user receives information about the created car.
Request
- Type: POST
- URL: /cars
- Parameters: None
- Body:
{
"make": "Honda",
"color": "Blue",
"price": 20000
}
Response
- Body:
{`
"id": 1,
"make": "Honda",
"color": "Blue",
"price": 20000
}
Response code: 201 CREATED
Get Car Information
Retrieve information about a specific car in a specific store.
Request
- Type: GET
- URL: /cars/{car_id}
- Parameters:
- car_id: the ID of the car
- Body: None
Response
- Body:
{
"id": 1,
"make": "Honda",
"color": "Blue",
"price": 20000,
"store_id": 1
}
Response code: 200 OK
Update Profile
Update information about the user's profile.
Request
- Type: PUT
- URL: /users/{user_id}
- Parameters:
- user_id: the ID of the user
- Body:
{
"name": "John Smith",
"email": "[email protected]"
}
Response
- Body:
{
"id": 1,
"name": "John Smith",
"email": "[email protected]"
}
Response code: 200 OK
Delete Car from Order
Delete a specific car from a specific order.
Request
- Type: DELETE
- URL: /orders/{order_id}/cars/{car_id}
- Parameters:
- order_id: the ID of the order
- car_id: the ID of the car
- Body: None
Response
- Body: None Response code: 204 NO CONTENT
View All Cars - Server Error
Retrieve information about all cars. However, the user receives a server error.
Request
- Type: GET
- URL: /cars
- Parameters: None
- Body: None
Response
- Body:
{
"message": "Internal Server Error"
}
Response code: 500 INTERNAL SERVER ERROR
Change Profile - Unauthorized Error
Update information about the user's profile. However, the user receives an unauthorized error.
Request
- Type: PUT
- URL: /users/{user_id}
- Parameters:
- user_id: the ID of the user
- Body:
{
"name": "John Smith",
"email": "[email protected]"
}
Response
- Body:
{
"message": "Unauthorized"
}
Response code: 401 UNAUTHORIZED