Get Cities
Description
Returns a list of cities. Maximum page size is 1000. Default page size is 1000.
Request
HTTP Method: GET
URI Path: /v3/cities
URI Query Parameters:
Name |
Type |
Is Required? |
Description |
---|---|---|---|
filter[<filter_name>] |
|
Optional |
|
include |
|
Optional |
|
sort |
|
Optional |
Includes:
Value |
Description |
---|---|
country |
|
region |
Filters:
Filter Name |
Type |
Allow Blank |
Allow Array |
Filters by: |
---|---|---|---|---|
id |
|
No |
Yes |
City |
name |
|
Yes |
Yes |
City |
country.id |
|
Yes |
Yes |
A |
region.id |
|
Yes |
Yes |
A |
is_available |
|
No |
No |
Indicates if DID numbers in the specified city are currently available for purchase |
Sorting:
Value |
Sorts by: |
---|---|
name |
City |
Examples
GET /v3/cities HTTP/1.1
Host: api.didww.com
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json
Api-Key: [API Token]
curl -i -X GET https://api.didww.com/v3/cities -H "Accept: application/vnd.api+json" -H "Api-Key: [API Token]" -H "Content-Type: application/vnd.api+json"
HTTP/2 200 OK
Content-Type: application/vnd.api+json
{
"data": [
{
"id": "dccb89ba-f777-4128-b99b-b25e19ccf4ea",
"type": "cities",
"attributes": {
"name": "Aachen"
},
"relationships": {
"country": {
"links": {
"self": "https://api.didww.com/v3/cities/dccb89ba-f777-4128-b99b-b25e19ccf4ea/relationships/country",
"related": "https://api.didww.com/v3/cities/dccb89ba-f777-4128-b99b-b25e19ccf4ea/country"
}
},
"region": {
"links": {
"self": "https://api.didww.com/v3/cities/dccb89ba-f777-4128-b99b-b25e19ccf4ea/relationships/region",
"related": "https://api.didww.com/v3/cities/dccb89ba-f777-4128-b99b-b25e19ccf4ea/region"
}
}
}
}
],
"meta": {
"total_records": 1,
"api_version": "2017-09-18"
},
"links": {
"first": "https://api.didww.com/v3/cities?page%5Bnumber%5D=1&page%5Bsize%5D=1000",
"last": "https://api.didww.com/v3/cities?page%5Bnumber%5D=2&page%5Bsize%5D=1000"
}
}
GET /v3/cities?filter%5Bname%5D=Springfield&filter%5Bcountry.id%5D=3b11ad09-dc7e-451a-9d32-ae9c1604aaa8 HTTP/1.1
Host: api.didww.com
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json
Api-Key: [API Token]
curl -i -X GET 'https://api.didww.com/v3/cities?filter%5Bname%5D=Springfield&filter%5Bcountry.id%5D=3b11ad09-dc7e-451a-9d32-ae9c1604aaa8' -H "Accept: application/vnd.api+json" -H "Api-Key: [API Token]" -H "Content-Type: application/vnd.api+json"
HTTP/1.1 200 OK
Content-Type: application/vnd.api+json
{
"data": [
{
"id": "79c1ee51-a2dd-4fb2-8c08-ab9120909118",
"type": "cities",
"attributes": {
"name": "Springfield"
},
"relationships": {
"country": {
"links": {
"self": "https://api.didww.com/v3/cities/79c1ee51-a2dd-4fb2-8c08-ab9120909118/relationships/country",
"related": "https://api.didww.com/v3/cities/79c1ee51-a2dd-4fb2-8c08-ab9120909118/country"
}
},
"region": {
"links": {
"self": "https://api.didww.com/v3/cities/79c1ee51-a2dd-4fb2-8c08-ab9120909118/relationships/region",
"related": "https://api.didww.com/v3/cities/79c1ee51-a2dd-4fb2-8c08-ab9120909118/region"
}
}
}
}
],
"meta": {
"total_records": 1,
"api_version": "2017-09-18"
},
"links": {
"first": "https://api.didww.com/v3/cities?filter%5Bcountry.id%5D=3b11ad09-dc7e-451a-9d32-ae9c1604aaa8&filter%5Bname%5D=Springfield&page%5Bnumber%5D=1&page%5Bsize%5D=1000",
"last": "https://api.didww.com/v3/cities?filter%5Bcountry.id%5D=3b11ad09-dc7e-451a-9d32-ae9c1604aaa8&filter%5Bname%5D=Springfield&page%5Bnumber%5D=1&page%5Bsize%5D=1000"
}
}
GET /v3/cities?include=country HTTP/1.1
Host: api.didww.com
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json
Api-Key: [API Token]
curl -i -X GET 'https://api.didww.com/v3/cities?include=country' -H "Accept: application/vnd.api+json" -H "Api-Key: [API Token]" -H "Content-Type: application/vnd.api+json"
HTTP/1.1 200 OK
Content-Type: application/vnd.api+json
{
"data": [
{
"id": "79c1ee51-a2dd-4fb2-8c08-ab9120909118",
"type": "cities",
"attributes": {
"name": "Springfield"
},
"relationships": {
"country": {
"links": {
"self": "https://api.didww.com/v3/cities/79c1ee51-a2dd-4fb2-8c08-ab9120909118/relationships/country",
"related": "https://api.didww.com/v3/cities/79c1ee51-a2dd-4fb2-8c08-ab9120909118/country"
}
},
"region": {
"links": {
"self": "https://api.didww.com/v3/cities/79c1ee51-a2dd-4fb2-8c08-ab9120909118/relationships/region",
"related": "https://api.didww.com/v3/cities/79c1ee51-a2dd-4fb2-8c08-ab9120909118/region"
}
}
}
}
],
"included": [
{
"id": "3b11ad09-dc7e-451a-9d32-ae9c1604aaa8",
"type": "countries",
"attributes": {
"name": "United States",
"prefix": "1",
"iso": "US"
},
"relationships": {
"regions": {
"links": {
"self": "https://api.didww.com/v3/countries/3b11ad09-dc7e-451a-9d32-ae9c1604aaa8/relationships/regions",
"related": "https://api.didww.com/v3/countries/3b11ad09-dc7e-451a-9d32-ae9c1604aaa8/regions"
}
}
}
}
],
"meta": {
"total_records": 1,
"api_version": "2017-09-18"
},
"links": {
"first": "https://api.didww.com/v3/cities?filter%5Bcountry.id%5D=3b11ad09-dc7e-451a-9d32-ae9c1604aaa8&filter%5Bname%5D=Springfield&page%5Bnumber%5D=1&page%5Bsize%5D=1000",
"last": "https://api.didww.com/v3/cities?filter%5Bcountry.id%5D=3b11ad09-dc7e-451a-9d32-ae9c1604aaa8&filter%5Bname%5D=Springfield&page%5Bnumber%5D=1&page%5Bsize%5D=1000"
}
}
Other Responses
Code |
Success |
Description |
---|---|---|
404 |
No |
|
401 |
No |