@varve/agency-sdks

Fetch Observations

Retrieve World Bank indicator observations by country and date range.

Use getIndicatorData() once you know an indicator code and one or more country codes.

const data = await client.getIndicatorData(['USA', 'CAN'], 'SP.POP.TOTL', {
  date: '2020:2024',
  perPage: 100,
});
 
for (const row of data.items) {
  console.log(row.countryiso3code, row.date, row.value);
}

Date ranges

World Bank date ranges use the provider's start:end syntax.

await client.getIndicatorData('USA', 'NY.GDP.MKTP.CD', {
  date: '2015:2024',
});

Pagination

Most list responses include a pagination object and an items array.

const page = await client.getIndicatorData('USA', 'SP.POP.TOTL', {
  date: '2000:2024',
  page: 1,
  perPage: 25,
});
 
console.log(page.pagination.pages);
console.log(page.items);

Use explicit pagination when you need predictable request sizes in jobs or user-facing dashboards.

On this page