1.0.3 • Published 2 years ago

@phoenixdev/softone-rest-api v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Softone API - Node.js Client

A Node.js client for the Softone REST API. Easily interact with the Softone REST API using this library.

Installation

npm i @phoenixdev/softone-rest-api
yarn add @phoenixdev/softone-rest-api

Getting started

GET API credentials from your Softone dealer .

Soft1 Web Services reference https://softone.gr/ws/.

Setup

Setup for the REST API integration :

const SoftoneRestApi = require('@phoenixdev/softone-rest-api');

const softone = new SoftoneRestApi({
  url: 'xxxx',
  username: 'xxxx',
  password: 'xxxx',
  appId: 'xxxx',
});

Options

OptionTypeRequiredDescription
urlStringyesSoftone oncloud.gr url
devUrlStringnoSandbox Softone oncloud.gr url. If empty add dev- to main url e.x. https://dev-demo.oncloud.gr
usernameStringyesYour username
passwordStringyesYour password
appIdIntegeryesYour application id
companyIntegernoLogin company. Used in loginAuthenticate and setAutoLogin
branchIntegernoLogin branch. Used in loginAuthenticate and setAutoLogin
moduleIntegernoLogin module. Used in loginAuthenticate and setAutoLogin
refIdIntegernoLogin refid. Used in loginAuthenticate and setAutoLogin
logindateStringnoLogin date for service login
timezoneoffsetStringnoLogin timezoneoffset for service login
sandboxBooleannoDefine if is sandox or not.Default is false
autoLoginBooleannoAuto login to Softone and store clientId for next requests
loginObjsIntegernoArray index of objs from login response. Used for auto login if not define company, branche, module and refId. Default index 0
encodingStringnoEncoding, default is utf-8
timeoutIntegernoDefine the request timeout
axiosConfigObjectnoDefine the custom Axios config, also override this library options

Methods

GET

  • .get( data)
  • .get( data, params, customEndPoint)
ParamsTypeDescription
dataObjectJS object to be converted into JSON and sent in the request
paramsObjectQuery strings params
customEndPointStringSoftone Custom endpoint

POST

  • .post( data)
  • .post( data, params, customEndPoint)
ParamsTypeDescription
dataObjectJS object to be converted into JSON and sent in the request
paramsObjectQuery strings params
customEndPointStringSoftone Custom endpoint

LOGIN

  • .login( data)
  • .login( data, params)
ParamsTypeDescription
dataObjectJS object to be converted into JSON and sent in the request
paramsObjectQuery strings params

AUTHENTICATE

  • .authenticate( data)
  • .authenticate( data, params)
ParamsTypeDescription
dataObjectJS object to be converted into JSON and sent in the request
paramsObjectQuery strings params

LOGINAUTHENTICATE

  • .loginAuthenticate( data)
  • .loginAuthenticate( data, params)
ParamsTypeDescription
dataObjectJS object to be converted into JSON and sent in the request
paramsObjectQuery strings params

SETAUTOLOGIN

  • .setAutoLogin()
  • .setAutoLogin( params)
ParamsTypeDescription
paramsObjectQuery strings params

Example of use can see in test and test with

yarn test

or

npm test

Release History

  • 2023-07-19 - v1.0.0 - Initial release.
1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago