Shiftboard API client

Usage no npm install needed!

<script type="module">
  import shiftboardApiClient from 'https://cdn.skypack.dev/@shiftboard/api-client';


Shiftboard API Client

wercker status

A Shiftboard API client.


yarn add @shiftboard/api-client

# Git
yarn add git+ssh://git@github.com:shiftboard/shiftboard-api-js.git

Running Tests

To run the unit tests:

yarn test


// Import library
import { apiClient } from '@shiftboard/api-client'
// or use the default export
import apiClient from '@shiftboard/api-client'

// Optionally, identify the app that is calling the API
const options = {
  'User-Agent': 'my-special-client'

// Create an instance of the client that accepts a baseURL, API key, secret, and options
const mySystemAPI = apiClient(baseURL, apiKey, apiSecret, options)

// Call your own methods
  .get(methodName, params)
  // Returns server response
  .then((response) => response.data)

// Create a user API instance
const myUserAPI = apiClient(baseURL, apiKey, apiSecret, options)

For live examples:

  • Review the helpers in the example.js file and run with node example.js
  • Review the helpers in the sandbox.js file and run with babel-node sandbox.js


The responses are promise-based, so you will need to handle things in a .then() function.

The promise is always resolved with a response object, except if there was a problem with the request! This is one of the goals of this library. It ensures errors are handled in .catch and have 2 separate flows.

A response will always have these 2 properties:

ok      - Boolean - True if API returns a `result` object or a non-200 status code
problem - String  - A message about what went wrong

If the request made it to the server and got a response of any kind, response will also have these properties:

data     - Object - this is probably the thing you're after.
status   - Number - the HTTP response code
headers  - Object - the HTTP response headers
config   - Object - the `axios` config object used to make the request
duration - Number - the number of milliseconds it took to run this request