Edit existing address
PUT/api/address/:id
Updates the data of an existing address associated with the company.
Functionality:
- Updates the provided fields of the address
- Validates that the address belongs to the authenticated company
- If new coordinates (lat/lng) are provided, updates the address data
- Validates the phone number format if modified
Editable fields:
- name: Descriptive name
- street: Street and number
- city: City
- postalCode: Postal code
- country: Country
- phone: Phone number (valid format)
- lat/lng: Coordinates for updating the address
- company_name: Name of the associated company
Restrictions:
- Only addresses belonging to the authenticated company can be edited
- The address ID must be valid and exist
Request example:
{
name: Main Warehouse (New Location),
street: Avenida Industrial 789,
city: Barcelona,
postalCode: 08002,
country: Spain,
phone: +34931234567,
lat: 41.3951,
lng: 2.1834,
company_name: Logística Barcelona S.L.
}
Request
Responses
- 200
- 400
- 401
Successfully updated address
Request error
Unauthorized