Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

List all the channels for the given pico_id.

ParameterDatatypeRequired
<pico_id><string>YES


Code Block
titlenewChannel
response = engine:listChannel(id).klog("Response Structure: ")
/*
 Response Structure:
	[
      {
		"id" : "id-0...",
		"name": "name 0",
		"type": "type 0"
 	  },
      {
		"id" : "id-1...",
		"name": "name 1",
		"type": "type 1"
 	  }
    ]
*/

...

Given an eci, get the pico_id that owns that channel.

ParameterDatatypeRequired
<eci><string>YES


Code Block
titleremoveChannel
pico_id = engine:getPicoIDByECI(eci).klog("Response Structure: ")
/*
 Response Structure:
	"some_pico_id"
*/

...

ParameterDatatypeRequired
<url><string>YES
<base><string>NO


The "base" key will have a value that contains the domain name where your krl file is located. ex: Fetch the ruleset krl code given by the `url` and register in the engine.

If you provide `base` then it will be resolved with the url. For example, `base` is  "http://raw.githubusercontent.com" The "url" key will complete the path appended to the base. ex: and `url` is "/username/repository1/file.txt" If the "pico_id" and "rid" keys are provided like in engine:installRuleset, the following directive error is given: {"error" : "registerRuleset expects, pico_id and rid or url+base"}.then the engine will register `http://raw.githubusercontent.com/username/repository1/file.txt`

Attempting to register a ruleset with the same rid as a rule that is already registered will pull the ruleset from the given base/url and act as an update action, overwriting the current file with the one from the remote repository.

...

Unregisters the ruleset given by the rid, or list of rids. It will throw an error if the ruleset is installed on any picos, or depended on by another ruleset.

ParameterDatatypeRequired
<rid>string | arrayYES

If your filename is myRuleset.krl, then the ruleset id will be "myRuleset".

...

uninstall a ruleset from a pico.  

ParameterDatatypeRequired
<pico_id><string>YES
<rid>string | array

YES

This does not return anything

...

Given a ruleset id, get more information about it.

ParameterDatatypeRequired
<rid><string>YES


Code Block
titleintall ruleset
response = engine:describeRuleset("io.picolabs.hello_world");
/*
 Response Structure:
    {
        "rid": "io.picolabs.hello_world",
        "src": "ruleset io.picolabs.hello_world{ ...<cut for brevity> ... }",
        "hash": "a096f2f3bfbd63e54bf4f39081814dbc895f3f003ae9918dbe24aec8acc097b9",
        "url": "https://raw.githubusercontent.com/Picolab/node-pico-engine-core/master/test-rulesets/hello-world.krl",
        "timestamp_stored": "2017-05-17T21:31:21.663Z",
        "timestamp_enable": "2017-05-17T21:31:21.663Z",
        "meta": {
            "name": "Hello World",
            "description": "\nA first ruleset for the Quickstart\n    ",
            "author": "Phil Windley"
        }
    }
*/

...