node-red-contrib-platio

0.1.4 • Public • Published

Platio Node for Node-RED

This node allows you to create, get, update and delete records in your Plate on Platio.

This node communicates with Platio using Platio API, so you need to know some basics about it. Please read Platio API Documents about Platio API.

OpenBlocks

Try node-red-contrib-platio-openblocks package to use Platio Node for Node-RED on a platform using old node.js like OpenBlocks.

Prepare your Plate and Platio API

  1. Create your Plate on Platio Studio.
  2. Add a user to your Plate. Don't forget to check [Allow API access to records and attachments].
  3. Open Platio Data Console of your Plate, and log in with this user.
  4. Go to the Developer page and check necessary information.

Common configurations

Node configurations

On each node, you can set an application and a collection you're going to use from Node-RED UI.

Name (name)
A name of the Node.
Application ID (applicationId)
An ID of an application (Plate).
Collection ID (collectionId)
An ID of a collection.
Authorization Header (authorization)
Set your authorization token for Platio API. Go to the Developer page in Platio Data Console and generate an API token. Then, paste a token at [Authorization Header].

Configurations per request

You can overwrite configurations you set as described above by setting values to msg.platio.

msg.platio = {
  applicationId: 'pxxxxxxxxxxxxxxxxxxxxxxxxxx',
  collectionId: 'txxxxxxx',
  authorization: 'Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
};

Error handling

When an error occurs, Platio Node reports it to Node-RED as an error. You can handle errors using catch Node.

Nodes

platio in

Using platio in node, you can get a specified record, or records that matches your search criteria.

In addition to the common configurations, you can configure these properties.

Record ID (recordId)
An ID of a record to get.
Limit (limit)
The maximum number of records to get.
Sort Key (sortKey)
Sort Key. One of column, createdAt, updatedAt, createdBy, updatedBy.
Sort Order (sortOrder)
Sort Order. ascending or descending.
Sort Column ID (sortColumnId)
An ID of a column you want to sort records by. You can specify this only when Sort Key is column.
Search Expression (search)
An expression to search records. See Record Query Syntax for details.
Time Zone (timezone)
Time Zone used when searching records, like America/Los_Angeles.

This node retrieves a specified record and set it to msg.payload when you set Record ID. See Platio API Documents for details about the record format.

It retrieves an array of records if you don't specify Record ID and set it to msg.payload.

When you set Limit, it retrieves records up to the number specified. It calls API multiple times when you set a value greater than the limit of API (100).

platio out

Using platio out node, you can create a new record, update and delete an existing record.

In addition to the common configurations, you can configure these properties.

Record ID (recordId)
An ID of a record to update or delete.
Delete (delete)
true to delete a specified record. false otherwise.

This node creates a new record with values specified in msg.payload when you don't specify Record ID.

It updates a specified record when you specify Record ID. Values not includes in msg.payload will be removed.

It deletes a specified record when you specify Record ID and set Delete to true. msg.payload won't be used in this case.

Specify values to msg.payload in this format when you create or update a record. Consult Platio API Documents for details.

msg.payload = {
  values: {
    cxxxxxxx: {
      type: 'Number',
      value: 20
    },
    cyyyyyyy: {
      type: 'String',
      value: 'Text'
    }
  }
};

Readme

Keywords

Package Sidebar

Install

npm i node-red-contrib-platio

Weekly Downloads

2

Version

0.1.4

License

MIT

Last publish

Collaborators

  • infoteria