Skip to content

Instantly share code, notes, and snippets.

@tgherzog
Last active March 18, 2024 15:51
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save tgherzog/e6090f9b2ba74f49f75b228f5c7169b9 to your computer and use it in GitHub Desktop.
Save tgherzog/e6090f9b2ba74f49f75b228f5c7169b9 to your computer and use it in GitHub Desktop.

Overview

The Data Catalog API enables users to retrieve the contents of the data catalog along with data and metadata about individual datasets and their resources.

All API endpoints begin with the protocol and hostname: https://datacatalogapi.worldbank.org

Dataset Endpoints

/ddhxext/DatasetList

Returns a list of published datasets. Use $top and $skip together to efficiently access the entire catalog with multiple calls.

Parameter Description Required
$top Number of datasets (default: 100) No
$skip Record offset (default: 0) No

Examples

/ddhxext/Search

Search the data catalog programatically.

Parameter Description Required
qname Specifies the search context and should be either 'dataset' or 'dataresource' Yes
qterm Search keywords. If blank then all records are returned Yes
$top Number of records to return (default: 50) No
$skip Record offset (default: 0) No
$filter Filter conditions No
$orderby Sort order No

Hint: you can infer helpful examples for $filter and $orderby by changing parameters in the search engine and noting the resulting changes to the URL.

Examples

/ddhxext/DatasetView

Return metadata for a dataset.

Parameter Description Required
dataset_unique_id Identifies the dataset Yes
version_id Used to retrieve prior versions; if omitted or blank, latest version is returned No

Hint: version information is provided in the maintanance information object of a dataset. To request a previous version, provide its version_id without the "@" prefix.

Examples

/ddhxext/CitationView

Return complete metadata for a dataset citation.

Parameter Description Required
citation_unique_id Identifies the citation Yes

Example

/ddhxext/IndicatorView

Return metadata for a dataset indicator.

Parameter Description Required
indicator_unique_id Identifies the indicator Yes

Example

/ddhxext/IndicatorViewAll

Return metadata for all of a dataset's indicators.

Parameter Description Required
dataset_unique_id Identifies the dataset Yes

Example

Resource Endpoints

/ddhxext/ResourceView

Return complete metadata for a resource (DatasetView only returns partial metadata for resources)

Parameter Description Required
resource_unique_id Identifies the resource Yes

/ddhxext/ResourceDownload

Download a resource file.

Parameter Description Required
resource_unique_id Identifies the resource Yes
version_id Must be included but should be blank Yes

Hint: resource downloads can be very large. To conserve memory, you might consider streaming the API response directly to a file, as demonstrated here.

Example

/ddhxtext/ResourceFileData

Access a CSV or Excel file as a JSON object.

Parameter Description Required
resource_unique_id Identifies the resource Yes
version_id Used to retrieve prior versions No
$filter filter expression (need example) No
rowLimit maximum number of rows to return No

Hint: Not all Excel files are available via this endpoint. In particular, Excel files that consist of multiple worksheets or that do not have well-formed column headers cannot be parsed.

Example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment