Changelog

NodeJS Library Quickstart

Configure Project

  1. First install the npm library in your project.
npm i @dapi-co/dapi-node
  1. Import Dapi's library in your code.
import DapiApp from '@dapi-co/dapi-node'
const DapiApp = require('@dapi-co/dapi-node')
  1. Create a Dapi app with your App Secret
import DapiApp from '@dapi-co/dapi-node'

const dapi = new DapiApp({
  appSecret: 'YOUR_APP_SECRET',
})
const DapiApp = require('@dapi-co/dapi-node')

const dapi = new DapiApp.default({
  appSecret: 'YOUR_APP_SECRET',
})
  1. Now you can use any of the functions of the DapiApp instance, dapi. Here is an example for getAccounts.
const DapiApp = require('@dapi-co/dapi-node')

const dapi = new DapiApp.default({
    appSecret: 'YOUR_APP_SECRET',
})

try {
    dapi.data.getAccounts('ACCESS_TOKEN', 'USER_SECRET')
        .then(accounts_response => {
            console.log(accounts_response)
            //do something with the response 
        })

} catch (error) {
    console.dir(error)
}