sdmx-rest

SDMX REST API client for JavaScript

Usage no npm install needed!

<script type="module">
  import sdmxRest from 'https://cdn.skypack.dev/sdmx-rest';
</script>

README

sdmx-rest4js

Build codecov.io CodeFactor Known Vulnerabilities semantic-release current version Mentioned in Awesome Official Statistics

This library allows to easily create and execute SDMX REST queries from a JavaScript client application.

In a nutshell, it allows you to:

  • Create data, metadata and data availability queries, using the getDataQuery, getMetadataQuery, getAvailabilityQuery functions;
  • Get instances of SDMX RESTful web services against which queries can be executed, using the getService function;
  • Execute a query against a web service and get the matching data or metadata, using the request function;
  • Build SDMX RESTful URLs that represent queries to be executed against SDMX RESTful web services, using the getUrl function. This is handy, in case you want to execute the query using, say, jQuery;

The example below shows how a query can be executed against a predefined service using the request function.

var sdmxrest = require('sdmx-rest');

var query = {flow: 'EXR', key: 'A.CHF.EUR.SP00.A'};

sdmxrest.request(query, 'ECB')
  .then(function(data) {console.log(data)})
  .catch(function(error){console.log("something went wrong: " + error)});

For detailed documentation about the API (and more examples), please check the Wiki.