Update City
Update an existing city. Requires authentication.
Endpoint
Authentication
Required
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id |
integer | Yes | City ID |
Request Body
Form data (multipart/form-data):
| Field | Type | Required | Description |
|---|---|---|---|
name |
string | No | City name (optional, only updates if provided) |
country_id |
integer | No | Country ID (optional, only updates if provided) |
Response
Success (200 OK)
{
"id": 1,
"name": "Baku",
"country_id": 1,
"country": {
"id": 1,
"name": "Azerbaijan",
"created": "2025-01-15T10:30:00Z"
},
"created": "2025-01-15T10:30:00Z"
}
Error Responses
Not Found (404)
or
Missing ID Parameter (400)
Bad Request (400)
Unauthorized (401)
Internal Server Error (500)
Example Request
curl -X PUT "https://api.luxmart.site/v1/accounts/city/?id=1" \
-H "Authorization: Token your_access_token" \
-F "name=Baku" \
-F "country_id=1"
Notes
- Only updates fields that are provided in the request
- Both
nameandcountry_idare optional - if not provided, they remain unchanged - If
country_idis provided, it must reference an existing, non-deleted country - The
updatedtimestamp is automatically set by the system - Returns 404 if city or country is not found or has been deleted