5. Other Libraries

July 14, 2021


Additional useful methods you can call from your plugin.
 

1. Make a Request to Erply API

 

ErplyAPI implements, under a namespace Helios.ErplyAPI, following methods:

 

Method

Comment

request

Regular request

bulkRequest 

Regular bulkRequest

Experimental methods

limitlessRequest

Request without limit on recordsOnPage, response returns statuses instead of status.

limitlessBulkRequest

BulkRequest without 100 request limit on number of requests.

requestMaxRecordsOnPage

Request with maximum number of records on the page.

requestAllRecords

Requests ALL records without out a need for a pageNo or a recordsOnPage, returns statuses instead of status.

 

Has an additional parameter requestsInBulk, which sets the maximum allowed requests in bulkRequests when requesting all records. Can be useful when the request breaks server memory limit.

 

This is useful if you need to sync all records that are in Erply. Be careful with large datasets, because all pages are going to be asked from API!

 

NB! 

  1. clientCode and sessionKey are included in all requests so there is no need specify those.

  2. Very large bulkRequests will break the server memory limit (indicated by error 500).

 

All ErplyAPI methods support both callbacks and promises:

 

Example:

 

const productID = 1;

const params = {

   request: 'getProducts',

   productID,

}

 

Helios.ErplyAPI.request(params, function(response, err) {

   if (err) throw err;

   console.log(response);

});

console.log('logging...')

// OR

try {

  const response = Helios.ErplyAPI.request(params);

  console.log(response);

 

  const bulkResponse = await Helios.ErplyAPI.bulkRe

quest({
    requests: [
        {
            requestName: 'getProducts',
            pageNo: 1,
        },
        {
            requestName: 'getProducts',
            pageNo: 2,
        }
    ]
  });

 

console.log(bulkResponse);

} catch(e) {

  console.error(e);

}

2. openFloatingWindow

Use this library if you want to show a floating box on-screen with additional content. It works best for displaying tabular information. User can drag the box around on screen, and close when they no longer need it. Multiple boxes can be open at the same time.

This is how the box looks on Berlin:



And on Classic:


 

For example, it has been used for:

- a new product search on sales documents (search results pop up in a box);

- and for showing previous transactions made with a product. (User can click an icon to open the list of product’s previous transactions.)

 

ErplyJsApi.openFloatingWindow(table, id, title)

  • table - floating window content (HTMLElement).

  • id - unique id for floating window

  • title - will be displayed above the table at the top of the window