0.50.2 • Published 3 years ago

powerlink-api v0.50.2

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

powerlink-api

This package provides an easy to use API which lets you connect your custom Backend/Frontend apps to your Powerlink data.


Initialization & Authentication

Backend: const api = new plapi(TOKEN_ID);\ Frontend - Development: const api = new plapi(TOKEN_ID);\ Frontend - Production: const api = new plapi();\ (The Powerlink App's cookie is used instead of a token in a production environment).

Create

import { plapi } from 'powerlink-api';

const api = new plapi();
api.create(objectType, { [fieldName]: value, ... });

Update

import { plapi } from 'powerlink-api';

const api = new plapi();
api.update(objectType, objectId, { [fieldName]: value, ... });

Delete

import { plapi } from "powerlink-api";

const api = new plapi();
api.delete(objectType, objectId);

Views

import { plapi } from "powerlink-api";

const api = new plapi();
api.getViews(objectType);

ViewRecords

import { plapi } from "powerlink-api";

const api = new plapi();
api.getViewRecords(objectType, viewId, config);

Config

PropertyDescriptionExample
fieldsAdditional fields { name: string, logicalName: string, fieldObjectType: number, label: string, type: string }, ...
pageNumberPage numberStarts at: 1
sortBySort byaccountname/idnumber/telephone1

Query

import { plapi } from "powerlink-api";

const api = new plapi();
api.query({
  objectType: 1,
  pageSize: 50,
  pageNumber: 1,
  fields: "accountname, idnumber, telephone1",
  query: "(idnumber = 12345678) AND (telephone1 = 036339060)",
  sortBy: "accountname",
  sortType: "desc",
});
PropertyDescriptionExample
objectTypeObject typeAccount = 1, Contact = 2, Cases = 5 (See more..)
pageSizeResult per pageMin: 1 Max: 500
pageNumberPage numberStarts at: 1
fieldsRecord's fieldsAll fields = "*"
queryQuery conditions((idnumber = 1234) AND (idnumber = 5678))
sortBySort byaccountname/idnumber/telephone1
sortTypeSort typedesc/asc

Query property:

OperatorDescriptionExample
=Equalquery: "(idnumber = 1234)"
!=Not Equalquery: "(idnumber != 1234)"
>Greater thanquery: "(age1 > age2)"
<Less thanquery: "(age1 < age2)"
<=Greater than or equal toquery: "(age1 <= age2)"
>=Less than or equal toquery: "(age1 >= age2)"
ORLogical ORquery: "((idnumber = 1234) OR (idnumber = 456789))"
ANDLogical Andquery: "((idnumber = 1234) AND (accountname = 'משה'))"
is-nullNULL valuesquery: "(idnumber is-null 1234567)"
is-not-nullNot NULL valuesquery: "(idnumber is-not-null 1234567)"
start-withStarts withquery: "(idnumber start-with 1234567)"
end-withEnds withquery: "(idnumber end-with 1234567)"
not-start-withDoesn't start withquery: "(idnumber not-start-with 1234567)"
not-end-withDoesn't end withquery: "(idnumber not-end-with 1234567)"

You can combine both the AND and OR conditions using parenthesis.

Note

  • AND & OR conditions allow you to test multiple conditions (order of operations applies).
0.0.51

3 years ago

0.50.2

3 years ago

0.0.50

3 years ago

0.0.41

3 years ago

0.0.31

3 years ago

0.0.32

3 years ago

0.0.35

3 years ago

0.0.36

3 years ago

0.0.20

3 years ago

0.0.21

3 years ago

0.0.22

3 years ago

0.0.25

3 years ago

0.0.15

3 years ago

0.0.16

3 years ago

0.0.10

3 years ago

0.0.11

3 years ago

0.0.12

3 years ago

0.0.13

3 years ago

0.0.14

3 years ago

0.0.1

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.22

3 years ago

1.0.21

3 years ago

1.0.20

3 years ago

1.0.26

3 years ago

1.0.25

3 years ago

1.0.24

3 years ago

1.0.23

3 years ago

1.0.29

3 years ago

1.0.28

3 years ago

1.0.27

3 years ago

1.0.11

3 years ago

1.0.30

3 years ago

1.0.15

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago