Registry / data / sdmx-rest

sdmx-rest

JSON →
library2.20.0jsnpmunverified

sdmx-rest (v2.20.0) is a JavaScript client for the SDMX REST API, enabling construction and execution of data, metadata, and availability queries against SDMX-compliant web services. It simplifies building REST URLs, managing predefined service instances, and handling responses with promises. The library is actively maintained, with semantic versioning and regular releases via semantic-release. Unlike raw HTTP clients, it abstracts query parameter construction and service definitions, making it suitable for statistical data retrieval in Node.js (>=10) or browser environments. Its main differentiators are built-in support for common SDMX endpoints (like ECB) and a fluent API for query building.

npm install sdmx-rest
INSTALL
IMPORT
SIG · SDMX-REST
S
sdmx-rest
datajavascriptv2.20.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

request
const sdmxrest = require('sdmx-rest'); sdmxrest.request(...)
import { request } from 'sdmx-rest'
The package exports a single object with methods. CommonJS require is the standard; ES import may fail without proper build.
getDataQuery
const { getDataQuery } = require('sdmx-rest')
import getDataQuery from 'sdmx-rest'
Named export via destructuring from the default export object. Direct import of named export is not supported.
getService
const { getService } = require('sdmx-rest')
const getService = require('sdmx-rest').getService
Equivalent, but destructuring is more idiomatic for multiple imports.

Executes a data query against the ECB SDMX service using the request function with a predefined flow and key.

const sdmxrest = require('sdmx-rest'); const query = {flow: 'EXR', key: 'A.CHF.EUR.SP00.A'}; sdmxrest.request(query, 'ECB') .then(data => console.log(data)) .catch(err => console.error(err));
Debug
Known issues
gotcharequire('sdmx-rest') returns an object, not a function. Common mistake: trying to call it directly.
fix
Use sdmxrest.request() instead of sdmxrest().
affects: >=1.0.0
gotchaThe package uses promises and requires a polyfill for environments without native Promise support (e.g., older Node < 0.12).
fix
Ensure Promise global is available or use a polyfill like es6-promise.
affects: >=1.0.0
gotchaPredefined services like 'ECB' may change URLs or require API keys. Not all services are public or accessible without authentication.
fix
Check service availability and use getService with custom base URL if needed.
affects: >=1.0.0
deprecatedCallbacks are deprecated; use promises or async/await.
fix
Use .then() and .catch() or async/await instead of callback parameter.
affects: >=2.0.0
Errors
Common errors & fixes
TypeError: sdmxrest is not a function
Calling the required module as a function instead of accessing its methods.
fix
Use sdmxrest.request(query, ...) instead of sdmxrest(query, ...).
Cannot find module 'sdmx-rest'
Package not installed or import path incorrect.
fix
Run 'npm install sdmx-rest' and ensure it's in node_modules.
Upgrade
Version history
2.20.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
37 hits · last 30 days
node
34
Resources
sdmx-rest — npm install sdmx-rest · libregistry