Formaloo JS API Client
Installation
npm install --save @formaloo/api-client
Usage
- import library
// using ES Modules
import { Formaloo } from '@formaloo/api-client'
// using CommonJS syntax
const { Formaloo } = require('@formaloo/api-client')
- create instance with your credentials
const formaloo = Formaloo.APIClient.create({
apiKey,
apiSecret,
writeKey,
})
- use available methods on client based on your needs
- Please note that either
useWriteKey
ortoken
should be present on all method calls. You can also create formaloo instance with onlywriteKey
to create a write-only client.
const response = await formaloo.customers.create({
email: 'customer@email.com',
phone_number: '+123456789',
useWriteKey: true, // for create/update operations you might want to use your write-only key instead of access token
token, // your access token obtained using your `KEY` and `SECRET`
})
NOTES:
- DO NOT USE your secret on client side (apps running in browser)
- You might want to use your write-only in browser or less secure environments which has limited access to create or update (patch) your data.