Manage all locations (both origins and vias) through a unified endpoint. This endpoint operates on the locations table without filtering by type.
For type-specific operations, use the dedicated /api/origenes or /api/vias endpoints which filter by location_type.
GET - List All Locations
Retrieves all locations regardless of type (both “origen” and “via”).
Response
Unique identifier for the location
Region or state (nullable)
Type of location: “origen” or “via”
Whether the location is active
Request Example
curl -X GET https://api.iclcotizaciones.com/api/locations \
-H "Cookie: session=your_session_token"
Response Example
[
{
"id": 1,
"name": "Shanghai",
"country": "China",
"region": "Shanghai",
"location_type": "origen",
"is_active": true
},
{
"id": 10,
"name": "Buenos Aires",
"country": "Argentina",
"region": "Buenos Aires",
"location_type": "via",
"is_active": true
}
]
{
"error": "No autorizado"
}
POST - Create Location
Creates a new location of any type. This endpoint requires admin permissions.
Admin Only: Only users with admin roles (DIRECTOR, GERENTE, ADMINISTRACION) can create locations.
Request Body
Type of location. Must be either “origen” or “via”
Whether the location is active
Request Example
curl -X POST https://api.iclcotizaciones.com/api/locations \
-H "Cookie: session=your_session_token" \
-H "Content-Type: application/json" \
-d '{
"name": "Hamburg",
"country": "Germany",
"region": "Hamburg",
"location_type": "via",
"is_active": true
}'
Response Example
{
"id": 30,
"name": "Hamburg",
"country": "Germany",
"region": "Hamburg",
"location_type": "via",
"is_active": true
}
{
"error": "No autorizado"
}
PUT - Update Location
Updates an existing location by ID. This endpoint requires admin permissions.
Admin Only: Only users with admin roles (DIRECTOR, GERENTE, ADMINISTRACION) can update locations.
Path Parameters
The unique identifier of the location to update
Request Body
Type of location. Must be either “origen” or “via”
Whether the location is active
Request Example
curl -X PUT https://api.iclcotizaciones.com/api/locations/30 \
-H "Cookie: session=your_session_token" \
-H "Content-Type: application/json" \
-d '{
"name": "Hamburg Port",
"country": "Germany",
"region": "Hamburg",
"location_type": "via",
"is_active": true
}'
Response Example
{
"id": 30,
"name": "Hamburg Port",
"country": "Germany",
"region": "Hamburg",
"location_type": "via",
"is_active": true
}
{
"error": "No autorizado"
}
DELETE - Delete Location
Deletes a location by ID. This endpoint requires admin permissions.
Admin Only: Only users with admin roles (DIRECTOR, GERENTE, ADMINISTRACION) can delete locations. This is a hard delete and cannot be undone.
Path Parameters
The unique identifier of the location to delete
Request Example
curl -X DELETE https://api.iclcotizaciones.com/api/locations/30 \
-H "Cookie: session=your_session_token"
Response Example
{
"error": "No autorizado"
}