Dukan icon

Dukan

Interact with the Dukan API

City Or Municipality → Get Many Cities

AI-generated

Summary

Retrieve a paginated list of cities or municipalities with optional filtering, sorting, field selection, and population of related fields from the Dukan API.

Inputs

  • Force Custom Auth Header — Toggle to use a custom API key for authentication instead of the credentials configured in the node.
  • Force Custom Base URL — Toggle to use a custom base URL for the API requests instead of the one from the credentials.
  • Custom Base URL — Specify the base URL to use for API requests when Force Custom Base URL is enabled. Should exclude the /v1/external suffix.
  • Custom API Key — Specify the API key for authentication when Force Custom Auth Header is enabled.
  • Page Number — Page number of the city list to retrieve, starting at 1.
  • Limit — Maximum number of city records to return in one request.
  • Sort — Specify fields to sort the city documents by. Supports single or multiple space-separated fields with optional ascending or descending order indicated by a leading -.
  • Populate Fields — Space-separated list of related fields to populate in the returned documents.
  • Select Fields — Space-separated list of document fields to include in the response.
  • Offset — Number of city records to skip before starting to return results.
  • Filter — A JSON string representing a MongoDB query object to filter the cities returned.

Output shape

a JSON object containing an array of city or municipality records, potentially paged and filtered as specified

Pagination is controlled via Page Number, Limit, and Offset parameters. The Filter parameter accepts MongoDB query syntax. Fields can be selected or populated as needed. Authentication and base URL can be overridden per request.

Examples

Example 1: Fetch the first page of 50 cities sorted by creation date descending, selecting only the name and state.

Set Page Number to 1, Limit to 50, Sort to '-createdAt', and Select Fields to 'name state'.

Example 2: Retrieve cities with a custom API key and base URL

Enable Force Custom Auth Header and provide the API key; enable Force Custom Base URL and set the custom base URL.

Links

Discussion