Create new service station
POST/api/oil/
Endpoint for registering a new service station in the system.
Requirements:
- Mandatory fields: name, address, city, country
- Geographic coordinates (latitude, longitude) must be valid
- The fuels field must be an array of strings with the available fuel types
Validations performed:
- Checks that no other station with the same name exists in the same city
- Verifies the format of the geographic coordinates
- Validates that all required fields are present
Use cases:
- Initial registration of stations in the system
- Data migration from other systems
- Bulk creation via scripts
Request example:
{
name: Estación Norte,
address: Avenida Principal 456,
city: Barcelona,
country: ES,
latitude: 41.3851,
longitude: 2.1734,
fuels: [diesel, gasolina95, gasolina98],
isActive: true
}
Request
Responses
- 201
- 400
Station created successfully. Returns the data of the created station.
Data validation error. This may be due to:
- Missing required fields
- Incorrect coordinate format
- Station name already exists in the city