svb-client
v2.6.1
Published
NodeJS request client for SVB API
Downloads
285
Readme
svb-client
NodeJS library which helps you make GET and POST requests to the SVB API.
If you received a test API key and no HMAC SECRET, you should use a non-empty ASCII string as a placeholder (for example "HMAC SECRET").
Installation
npm install svb-client --save
Usage
const SVB = require('svb-client');
let client = new SVB({
API_KEY: '',
// HMAC_SECRET is optional during API tests
HMAC_SECRET: '',
// options below are optional, depending on use-case
BASE_URL: ''
});
client.get('/v1', 'test=1', (err, data) => {
...
});
client.post('/v1', { "data": "foo" }, (err, data) => {
...
});
// similar
client.patch(url, jsondata, callback);
client.delete(url, callback);
// uploading a file (png, jpg, or pdf)
const fs = require('fs');
client.upload('/v1/files', fs.createReadStream(__dirname + '/file.png'), 'image/png', (err, data) => {
...
});