On this page
article
2.2.4 Get the Full List of Cities
GetCities
-
API: getCities
-
Purpose and Use Cases: You can use this API endpoint to retrieve the list of cities we support.
-
Request:
| Attribute Name | Data Type | Required | Details |
|---|---|---|---|
| countryId | ID | Yes | Identifier for the related Country object |
| pageNumber | Int | No | The number of the page |
| pageSize | Int | No | The size of the page |
QUERY
query GetCities($countryId: ID!, $pageNumber: Int, $pageSize: Int) {
getCities(countryId: $countryId, pageNumber: $pageNumber, pageSize: $pageSize) {
pageInfo {
total
totalPages
currentPage
pageSize
}
cities {
id
name
countryId
}
}
}
GRAPHQL VARIABLES
{
"countryId": "eyJ0eXBlIjoiQ291bnRyeSIsImlkIjoxfQ",
"pageNumber": 1,
"pageSize": 5
}
- Response:
{
"data": {
"getCities": {
"pageInfo": {
"total": 257,
"totalPages": 52,
"currentPage": 1,
"pageSize": 5
},
"cities": [
{
"id": "eyJ0eXBlIjoiQ2l0eSIsImlkIjozfQ==",
"name": "Langhorne",
"countryId": "eyJ0eXBlIjoiQ291bnRyeSIsImlkIjoxfQ=="
},
{
"id": "eyJ0eXBlIjoiQ2l0eSIsImlkIjo1fQ==",
"name": "Tallahassee",
"countryId": "eyJ0eXBlIjoiQ291bnRyeSIsImlkIjoxfQ=="
},
{
"id": "eyJ0eXBlIjoiQ2l0eSIsImlkIjo2fQ==",
"name": "Salem, MA",
"countryId": "eyJ0eXBlIjoiQ291bnRyeSIsImlkIjoxfQ=="
},
{
"id": "eyJ0eXBlIjoiQ2l0eSIsImlkIjo5fQ==",
"name": "Dover, NH",
"countryId": "eyJ0eXBlIjoiQ291bnRyeSIsImlkIjoxfQ=="
},
{
"id": "eyJ0eXBlIjoiQ2l0eSIsImlkIjoxMH0=",
"name": "Radford, VA",
"countryId": "eyJ0eXBlIjoiQ291bnRyeSIsImlkIjoxfQ=="
}
]
}
}
}
GetCity
-
API: getCity
-
Purpose and Use Cases: You can use this API endpoint to retrieve detailed information about the cities we support.
-
Request:
| Attribute Name | Data Type | Required | Details |
|---|---|---|---|
| id | ID | Yes | Unique identifier for the city |
QUERY
query GetCity($getCityId: ID!) {
getCity(id: $getCityId) {
id
name
countryId
}
}
GRAPHQL VARIABLES
{
"getCityId": "eyJ0eXBlIjoiQ2l0eSIsImlkIjozfQ"
}
- Response:
{
"data": {
"getCity": {
"id": "eyJ0eXBlIjoiQ2l0eSIsImlkIjozfQ==",
"name": "Langhorne",
"countryId": "eyJ0eXBlIjoiQ291bnRyeSIsImlkIjoxfQ=="
}
}
}
City Object
| Attribute Name | Data Type | Details |
|---|---|---|
| id | ID | Unique identifier for the City object |
| name | String | Name of the city |
| countryId | ID | Identifier for the related Country object |