Skip to main content

citiesByCountry

Overview

Fetch the list of cities that belong to a specific country.

Query

query FindAllCitiesByCountry($countryId: ID!) {
findAllCitiesByCountry(countryId: $countryId) {
success
message
data {
_id
name
description
active
deleted
country {
_id
name
image { image imageUrl }
code
continent
capital
active
deleted
phonekey
createdAt
updatedAt
}
}
}
}

Variables

{
"countryId": "<COUNTRY_ID>"
}

Examples

curl -X POST \
https://subdomain.com\
-H "Content-Type: application/json" \
-H "Authorization: Bearer <TOKEN>" \
--data-binary @- << 'EOF'
{
"query": "query FindAllCitiesByCountry($countryId: ID!) { findAllCitiesByCountry(countryId: $countryId) { success message data { _id name } } }",
"variables": { "countryId": "<COUNTRY_ID>" }
}
EOF

Notes

  • Replace <TOKEN> and <COUNTRY_ID> with valid values.
  • You can expand the selected fields under data as needed (e.g., description, active).