Create City
Create a new city. Requires authentication.
Endpoint
Authentication
Required
Request Body
Form data (multipart/form-data):
| Field | Type | Required | Description |
|---|---|---|---|
name |
string | Yes | City name |
country_id |
integer | Yes | Country ID |
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
Bad Request (400)
or
or
Not Found (404)
Unauthorized (401)
Internal Server Error (500)
Example Request
curl -X POST "https://api.luxmart.site/v1/accounts/city/" \
-H "Authorization: Token your_access_token" \
-F "name=Baku" \
-F "country_id=1"
Notes
- Both
nameandcountry_idare required - The country must exist and not be deleted
- The
createdtimestamp is automatically set by the system - The
idis automatically generated - Returns 404 if the specified country does not exist