states
Public: no authentication required.
Get states/provinces for a country
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
query States($countryCode: String!) {
states(countryCode: $countryCode) {
code
name
capital
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "query States($countryCode: String!) {\n states(countryCode: $countryCode) {\n code\n name\n capital\n }\n}",
"variables": {
"countryCode": "string"
}
}
EOF
Variables:
{
"countryCode": "string"
}
Response:
{
"data": {
"states": [
{
"code": "string",
"name": "string",
"capital": "string"
}
]
}
}
states(
countryCode: String!
): [StateListItem!]!
Arguments
states.countryCode ● String! non-null scalar
The two-letter ISO country code.
Type
StateListItem object
A state or region to pick from.