Edara API v3: Cities
Read the guide first: authentication, paging, errors, rate limits and the shared PagedResult, BatchResult and *Reference shapes.
GET /v3/cities: Lists cities.GET /v3/cities/{id}: Gets a city by id.POST /v3/cities: Creates a city.PUT /v3/cities/{id}: Updates a city.DELETE /v3/cities/{id}: Deletes a city.
Endpoints
GET /v3/cities: Lists cities.
Operation GetCities · permission read:city
Query string: GetCitiesQuery
| field | type | default | validation | description |
|---|---|---|---|---|
offset |
int? |
0 | >= 0 | Number of items to skip before returning results. Defaults to 0. |
limit |
int? |
100 | 1..1000 (out of range → 400) | Maximum number of items to return. Defaults to 100, maximum 1000. |
name |
string |
Optional city name filter. | ||
countryId |
int? |
Optional country identifier filter. |
Responses: OK PagedResult<CityResponse>: Paged list of cities.
Notes
nameis a partial match: it finds every city whose name contains the text you send. Anamethat is only whitespace is ignored.countryIdis an exact match.- There are no hidden default filters. Omitting
nameandcountryIddoes not narrow the list. - Results are ordered by
nameascending. totalCountis the number of cities that match the filters, not the number on the page.- When nothing matches you get
200with an emptyitemslist andtotalCount0. - Tab characters are removed from
namein this list. The get-by-id endpoint returnsnameas stored, so the two can differ. pagein the response isoffsetdivided bylimit, plus 1.
GET /v3/cities/{id}: Gets a city by id.
Operation GetCityById · permission read:city
Parameters
| name | in | type | default | description |
|---|---|---|---|---|
id |
route | int |
The city id. |
Responses: OK CityResponse: The city.
Notes
- An
idthat does not exist returns404. nameis returned exactly as stored. The list endpoint removes tab characters fromname, so the two can differ.
POST /v3/cities: Creates a city.
Operation CreateCity · permission create:city
Body: CityUpsertRequest
| field | type | default | validation | description |
|---|---|---|---|---|
name |
string |
NotEmpty() .NotNull() .MaximumLength(100) | The city name. | |
countryId |
int |
GreaterThan(0) | The country identifier. |
Responses: Created CityResponse: The created city.
Business errors (HTTP 409, match on errorCode):
DupplicatedName: Another city already uses the same name.
Notes
nameis trimmed before it is saved.- Only
nameandcountryIdare read from the body. Anything else you send is ignored. - A
countryIdthat does not exist returns400with noerrorCode. - A city name must be unique within its country. A duplicate returns
409witherrorCodeDupplicatedName, and the same name in a different country is allowed.
PUT /v3/cities/{id}: Updates a city.
Operation UpdateCity · permission update:city
Parameters
| name | in | type | default | description |
|---|---|---|---|---|
id |
route | int |
The city id. |
Body: CityUpsertRequest
| field | type | default | validation | description |
|---|---|---|---|---|
name |
string |
NotEmpty() .NotNull() .MaximumLength(100) | The city name. | |
countryId |
int |
GreaterThan(0) | The country identifier. |
Responses: OK CityResponse: The updated city.
Business errors (HTTP 409, match on errorCode):
DupplicatedName: Another city already uses the same name.
Notes
- This is a full replace, not a partial update. Send both
nameandcountryIdevery time; leaving outcountryIdreturns400. - The
idin the path is the one used. Anidin the body is ignored. - An
idthat does not exist returns404and nothing is changed. - A
namealready used by another city in the same country returns409witherrorCodeDupplicatedName. - A
countryIdthat does not exist returns400with noerrorCode.
DELETE /v3/cities/{id}: Deletes a city.
Operation DeleteCity · permission delete:city
Parameters
| name | in | type | default | description |
|---|---|---|---|---|
id |
route | int |
The city id. |
Responses: NoContent: (not declared; read from the method body)
Business errors (HTTP 409, match on errorCode):
ItemCannotDeleteItInUse: The city is still referenced by related records and cannot be deleted.
Notes
- The delete is permanent. Cities have no deactivated or soft-deleted state.
- An
idthat does not exist returns404. Success returns204with an empty body. - A city that is still in use returns
409witherrorCodeItemCannotDeleteItInUse. A city is in use when a district, customer, customer address, warehouse or account refers to it. - Delete a city's districts before you delete the city.
Types
CityResponse
Response describing a city.
| field | type | description |
|---|---|---|
id |
int |
The city identifier. |
name |
string |
The city name. |
countryId |
int |
The country identifier. |