Javascript Library

Getting started

This library provide Manager for all Endpoints and an abstracted interface to work with Records. It is build as JS Module to be used with webpack.

Installation

npm i @redoo-networks/flexapi --save-dev

yarn add @redoo-networks/flexapi --save-dev

npmjs.com Page

Github

Setup

User Access mode

This access mode, use vtigercrm similar to the web frontend. User credentials or an access token are needed to access data.

Using with access token

import FlexAPI from '@redoo-networks/flexapi/flexapi';

FlexAPI.setCRMUrl('https://crmurl');
FlexAPI.setToken('AccessToken');

Using with user login

You get a access token within the promise. You should store this token temporarily to clear the user login from storage.

import FlexAPI from '@redoo-networks/flexapi/flexapi';

FlexAPI.setCRMUrl('https://crmurl');

FlexAPI.setCRMLogin('username', 'password')
    .then(token => {
        console.log(token);
    });

Customer Access mode

This access mode, use vtigercrm as customer with very limit permissions.
You must define in Backend, which records are visible.
You cannot use all endpoints in customer mode, because they must implement permission handling

Using with access token

import FlexAPI from '@redoo-networks/flexapi/flexapi';

FlexAPI.setCRMUrl('https://crmurl');

FlexAPI.setCustomerToken('AccessToken');

Using with customer credentials

import FlexAPI from '@redoo-networks/flexapi/flexapi';

FlexAPI.setCRMUrl('https://crmurl');

FlexAPI.loginCustomer('customer@domain.com', 'CPKEY').then(customerData => {
    console.log(customerData);
});
customerData Structure

Attributes

Type

Description

accountid

integer

AccountID, which is logged in

accountname

string

Account Name, which is logged in

contactid

integer

Contact ID, which is logged in

id

integer

Contact or Account ID, which is logged in

label

string

Label of logged in customer record

reset-pw

boolean

Should user set a new password

token

string

Access Token for further logins

Changelog

All notable changes to this CRM module will be documented in this file.

This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

[1.0] - 2021-04-27

  • First documented version


Last update: Oct 12, 2022