@quantix-ict/exact-online
v1.1.0
Published
Package for Exact Online (Quantix)
Downloads
863
Maintainers
Readme
Exact online client by Quantix
A library to use the exact online API.
Installation and Usage
Installation:
npm i @quantix-ict/exact-online
Usage:
const { Exact } = require('@quantix-ict/exact-online')
const exact = new Exact({
clientId: 'CLIENT_ID',
clientSecret: 'CLIENT_SECRET',
redirectUri: 'https://example.com/exact-online/connect',
})
await exact.initialize()
const data = await exact.request({
endpoint: '/project/Projects',
params: {
$filter: 'Type eq 1',
},
method: 'GET', // optional, uses 'GET' by default
division: '1234567', // optional, uses current division by default
})
of using import:
import { Exact } from '@quantix-ict/exact-online'
const exact = new Exact({
clientId: 'CLIENT_ID',
clientSecret: 'CLIENT_SECRET',
redirectUri: 'https://example.com/exact-online/connect',
})
await exact.initialize()
const data = await exact.request({
endpoint: '/project/Projects',
params: {
$filter: 'Type eq 1',
},
method: 'GET', // optional, uses 'GET' by default
division: '1234567', // optional, uses current division by default
})
Connecting to exact online
- Get the login url:
const loginUrl = exact.getLoginUrl({
responseType: 'code', // optional, 'code' by default
forceLogin: true, // optional, false by default
})
Redirect the user to the loginUrl.
User performs login in exact environment. And gets redirected to redirectUri (https://example.com/exact/connect?code=ascjen4)
Send code from URL Params to the backend.
Call connect with the code on the backend.
const connected = await exact.connect(code)
Exact online API documentation
You can find the Exact online API documentation here.
More information about the API can be found here.