Update service station
PUT/api/oil/:id
Endpoint to modify data of an existing service station.
Modifiable fields:
- All fields of the OilStation schema can be updated
- The ID cannot be modified
- Required fields must remain present
Validations performed:
- Verifies that the station exists
- Checks that the name is not duplicated in the same city
- Validates the geographic coordinates format
- Ensures that mandatory fields remain
Use cases:
- Data update due to physical changes at the station
- Correction of erroneous information
- Update of available fuel types
Request example:
{
name: Estación Norte Renovada,
address: Avenida Principal 456,
city: Barcelona,
country: ES,
latitude: 41.3851,
longitude: 2.1734,
fuels: [diesel, gasoline95, gasoline98, LPG],
isActive: true
}
Request
Responses
- 200
- 400
- 404
Station updated successfully. Returns the updated data.
Data validation error. This may be due to:
- Missing required fields
- Incorrect coordinate format
- Station name already exists in the city
Station not found with the provided ID