node-red-contrib-mnubo 2.0.0

Mnubo

npm install node-red-contrib-mnubo

Table of Content

1. Introduction

2. Architecture

3. Pre-requisites

4. Installation & Configuration

5. Usage

6. Important notes

7. Source code

8. Known limitations

9. References


1. Introduction

This is the implementation of the mnubo's SmartObjects functionality in the node-red environment.

Note that this package is also compatible with other node-red environments, like IBM Bluemix and AT&T Flow.


2. Architecture

This is a front-end implementation of the https://www.npmjs.com/package/mnubo-sdk

Detailed info is available on the individual node in node-red.

Here is a brief description of the nodes:

mnubo config: This is the Configuration Node that holds the mnubo's SmartObjects credential, all nodes need to have this configured.

Auth: This node is used to fetch the access token for communication with SmartObjects. This node will also allow you to get the status about the token.

Owners : This node is used to handle the Owners Ingestion API: Create, Update, Delete, Claim Object, unClaim Object

Objects : This node is used to handle the Objects Ingestion API: Create, Update, Delete

Events : This node is used to handle the Events Ingestion API: Send, SendFromDevice

Analytics : This node is used to handle the Search API: getDataset, getDataModel, SearchQurery


3. Prerequisites

This is a node-red package, so it requires node-red, The minimum version of node-red supported is v0.10.10

To use the mnubo's SmartObjects nodes, you will need to have a valid mnubo account, with access granted on a namespace. To obtain your unique namespace in the SmartObjects platform, contact sales@mnubo.com . Please use the subject title node-red-contrinb-mnubo and include in the body of the email the name of your company, contact name and phone number.

The Official reference API can be found in the following: [API documentation]

(https://smartobjects.mnubo.com/documentation/index.html).

This package also requires the following package:

Those packages will be installed automatically by npm, as they are dependent packages.


4. Installation & Configuration

Linux installation

sudo npm install --prefix ~/.node-red node-red-contrib-mnubo

Windows installation (using Cygwin)

npm install --prefix ~/.node-red node-red-contrib-mnubo
mkdir %homepath%/.node-red/nodes
cp -rp %homepath%/node_modules/node-red-contrib-mnubo %homepath%/.node-red/nodes/

AT&T flow

Note that this node is also compatible with the AT&T Flow, to use it in flow, just edit the package.json in your flow project, and add this node in the depedency:

"dependencies":{"node-red-contrib-mnubo":"^1.0.3"}

    Then, when you will " enter the Online mode", you should have access to the mnubo nodes.

5. Usage

Examples

Example 1: Quick Demo

Here is a quick demo that shows how to authenticate, create owner, update owner, create object, update object, send event, do a basicSearchQuery, delete the object, delete the owner:

[{"id":"62d4d30d.157ddc","type":"tab","label":"Mnubo Node Test","disabled":false,"info":""},{"id":"65eee8e9.28a198","type":"mnubo auth","z":"62d4d30d.157ddc","name":"","mnuboconfig":"549b4ab6.77e814","x":320,"y":40,"wires":[["ff13f8fb.4cedb8"]]},{"id":"e75b51ac.767b5","type":"inject","z":"62d4d30d.157ddc","name":"","topic":"Test All","payload":"","payloadType":"none","repeat":"","crontab":"","once":false,"x":76,"y":40,"wires":[["65eee8e9.28a198"]]},{"id":"ff13f8fb.4cedb8","type":"switch","z":"62d4d30d.157ddc","name":"Token != Bearer","property":"payload.type","propertyType":"msg","rules":[{"t":"neq","v":"Bearer","vt":"str"},{"t":"eq","v":"Bearer","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":580,"y":40,"wires":[["16a4f697.c76289"],["56ef3af8.395824","5fd5573d.24f5e8"]]},{"id":"664822fc.9ac73c","type":"mnubo owners","z":"62d4d30d.157ddc","name":"","mnuboconfig":"549b4ab6.77e814","functionselection":"create","inputtext":"","x":406,"y":995,"wires":[["8c981039.bc8fa"]]},{"id":"3b83f946.755be6","type":"mnubo owners","z":"62d4d30d.157ddc","name":"","mnuboconfig":"549b4ab6.77e814","functionselection":"delete","inputtext":"","x":442,"y":303,"wires":[["52b214ae.5d1bec","cdd33037.3ef63"]]},{"id":"16a4f697.c76289","type":"debug","z":"62d4d30d.157ddc","name":"Error","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":790,"y":23,"wires":[]},{"id":"56ef3af8.395824","type":"debug","z":"62d4d30d.157ddc","name":"OK","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":790,"y":54,"wires":[]},{"id":"dc90bf39.da161","type":"inject","z":"62d4d30d.157ddc","name":"","topic":"clean","payload":"[email protected]","payloadType":"none","repeat":"","crontab":"","once":false,"x":77,"y":299,"wires":[["3a85aa52.02db16"]]},{"id":"abf75643.6535a8","type":"inject","z":"62d4d30d.157ddc","name":"","topic":"","payload":"","payloadType":"none","repeat":"","crontab":"","once":false,"x":77,"y":100,"wires":[["5fd5573d.24f5e8"]]},{"id":"e249c52a.79e5c8","type":"mnubo owners","z":"62d4d30d.157ddc","name":"","mnuboconfig":"549b4ab6.77e814","functionselection":"update","inputtext":"","x":414,"y":1070,"wires":[["8e077b9f.7792d8"]]},{"id":"aac1edc7.53f2a","type":"mnubo objects","z":"62d4d30d.157ddc","name":"","mnuboconfig":"549b4ab6.77e814","functionselection":"create","inputtext":"","x":413,"y":1155,"wires":[["92bd0647.9f9238"]]},{"id":"57b31c3f.1e6e54","type":"mnubo objects","z":"62d4d30d.157ddc","name":"","mnuboconfig":"549b4ab6.77e814","functionselection":"delete","inputtext":"","x":433,"y":219,"wires":[["5c4e8a4a.60b4d4","3a85aa52.02db16"]]},{"id":"6af7732f.a1017c","type":"inject","z":"62d4d30d.157ddc","name":"","topic":"clean","payload":"[email protected]","payloadType":"none","repeat":"","crontab":"","once":false,"x":78,"y":215,"wires":[["ab7b9d9c.ab29"]]},{"id":"87f7d975.df59d8","type":"debug","z":"62d4d30d.157ddc","name":"Error","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":783,"y":203,"wires":[]},{"id":"2b968d8e.010c52","type":"debug","z":"62d4d30d.157ddc","name":"OK","active":true,"console":"false","complete":"payload","x":783,"y":235,"wires":[]},{"id":"85645a52.854cc8","type":"mnubo objects","z":"62d4d30d.157ddc","name":"","mnuboconfig":"549b4ab6.77e814","functionselection":"update","inputtext":"","x":403,"y":1231,"wires":[["c5dec142.ce23e"]]},{"id":"5cde63e4.fce85c","type":"mnubo events","z":"62d4d30d.157ddc","name":"Default Settings","mnuboconfig":"549b4ab6.77e814","functionselection":"send","inputtext":"","reportResults":false,"objectsMustExist":false,"x":409,"y":1302,"wires":[["65331875.c56b48"]]},{"id":"29b37de0.e89db2","type":"mnubo events","z":"62d4d30d.157ddc","name":"","mnuboconfig":"549b4ab6.77e814","functionselection":"sendfromdevice","inputtext":"[\n    \"node-red-device-auto1\", \n    [{\n\t\"x_event_type\": \"event_type_test\",\n\t\"x_timestamp\": \"2015-01-22T00:01:25-02:00\",\n\t\"x_latitude\": 57.876,\n\t\"x_longitude\": 57.876,\n\t\"temperature\": 15.2\n    }]\n]","reportResults":false,"objectsMustExist":false,"x":505,"y":1502,"wires":[["c63f44c0.84b448"]]},{"id":"1e096ed7.aa8b61","type":"mnubo analytics","z":"62d4d30d.157ddc","name":"","mnuboconfig":"549b4ab6.77e814","searchtype":"SearchQuery","inputquery":"","x":396.00000381469727,"y":1738.999948501587,"wires":[["26d284bf.43c5cc"]]},{"id":"5e753cd4.3ff334","type":"function","z":"62d4d30d.157ddc","name":"Create Owner","func":"return { \n    \"payload\": {\n    \t\"username\": flow.get(\"mnubo_variables\").owner1,\n    \t\"x_password\": \"12345678\",\n    \t\"gender\": \"male\",\n    \t\"age\": 26\n    }\n};","outputs":1,"noerr":0,"x":189.44447326660156,"y":994.8888549804688,"wires":[["664822fc.9ac73c"]]},{"id":"2db7e0dc.696e","type":"function","z":"62d4d30d.157ddc","name":"Create an Object","func":"msg.payload = {\n\t\"x_device_id\": flow.get(\"mnubo_variables\").object1,\n    \"x_object_type\": \"test-object_type\",\n\t\"x_owner\": {\n\t\t\"username\": flow.get(\"mnubo_variables\").owner1\n\t},\n\t\"color\": \"red\"\n};\nreturn msg;","outputs":1,"noerr":0,"x":191.44444274902344,"y":1154.111083984375,"wires":[["aac1edc7.53f2a"]]},{"id":"a9eb87b4.a8d918","type":"function","z":"62d4d30d.157ddc","name":"Send an event","func":"msg.payload = [{\n\t\"x_object\": {\"x_device_id\": flow.get(\"mnubo_variables\").object1},\n\t\"x_event_type\": \"measurement\",\n\t\"x_timestamp\": new Date().toISOString(),\n\t\"x_latitude\": 57.876,\n\t\"x_longitude\": 57.876,\n\t\"temperature\": 25.6\n}];\nreturn msg;","outputs":1,"noerr":0,"x":180,"y":1360,"wires":[["5cde63e4.fce85c","b2c7d5ad.2ddde8","61ad9239.eaf56c","44a45130.5859d"]]},{"id":"6fe9ffd7.fbcb7","type":"function","z":"62d4d30d.157ddc","name":"Count Events","func":"return { \"payload\":\n    {\n    \t\"from\": \"event\",\n    \t\"select\": [{\n    \t\t\"count\": \"*\"\n    \t}]\n    }\n};","outputs":1,"noerr":0,"x":164.22222900390625,"y":1741.111083984375,"wires":[["1e096ed7.aa8b61"]]},{"id":"cb04c21a.42ae","type":"function","z":"62d4d30d.157ddc","name":"Update owner","func":"msg.payload = [ \n  flow.get(\"mnubo_variables\").owner1, \n  { \n\t\"x_registration_latitude\": 45.223, \n\t\"x_registration_longitude\": 73.234,\n\t\"age\": 29\n  }\n];\nreturn msg;","outputs":1,"noerr":0,"x":185.44442749023438,"y":1070.6666259765625,"wires":[["e249c52a.79e5c8"]]},{"id":"8c591651.dc9a98","type":"function","z":"62d4d30d.157ddc","name":"Update Object","func":"msg.payload = [\n    flow.get(\"mnubo_variables\").object1, \n    { \n        \"color\": \"white\"\n    }\n];\nreturn msg;\n","outputs":1,"noerr":0,"x":195,"y":1233,"wires":[["85645a52.854cc8"]]},{"id":"4dce4415.d9995c","type":"function","z":"62d4d30d.157ddc","name":"Send an Event FROM the object","func":"msg.payload = [\n    flow.get(\"mnubo_variables\").object1, \n    [{\n\t\"x_event_type\": \"measurement\",\n\t\"x_timestamp\": new Date().toISOString(),\n\t\"x_latitude\": 57.876,\n\t\"x_longitude\": 57.876,\n\t\"temperature\": 15.2\n    }]\n];\n\nreturn msg;","outputs":1,"noerr":0,"x":195,"y":1562,"wires":[["29b37de0.e89db2","cb30d6d4.d02468","e76a62e0.41818","bdf9f923.88bc08"]]},{"id":"5fd5573d.24f5e8","type":"function","z":"62d4d30d.157ddc","name":"set global env","func":"//Flow context share by all functions\nflow.set(\"mnubo_variables\", {\n    owner1: \"[email protected]\",\n    object1: \"node-red-device-auto\"\n});\nreturn msg;","outputs":1,"noerr":0,"x":306,"y":100,"wires":[["ab7b9d9c.ab29"]]},{"id":"3a85aa52.02db16","type":"function","z":"62d4d30d.157ddc","name":"delete owner1","func":"msg.payload = flow.get(\"mnubo_variables\").owner1;\nreturn msg;","outputs":1,"noerr":0,"x":254,"y":302,"wires":[["3b83f946.755be6"]]},{"id":"ab7b9d9c.ab29","type":"function","z":"62d4d30d.157ddc","name":"delete object1","func":"msg.payload = flow.get(\"mnubo_variables\").object1;\nreturn msg;","outputs":1,"noerr":0,"x":236,"y":219,"wires":[["57b31c3f.1e6e54"]]},{"id":"cfcc28bc.94e318","type":"inject","z":"62d4d30d.157ddc","name":"","topic":"","payload":"","payloadType":"none","repeat":"","crontab":"","once":false,"x":80,"y":940,"wires":[["5e753cd4.3ff334"]]},{"id":"b2c7d5ad.2ddde8","type":"mnubo events","z":"62d4d30d.157ddc","name":"Report Results","mnuboconfig":"549b4ab6.77e814","functionselection":"send","inputtext":"","reportResults":true,"objectsMustExist":false,"x":409,"y":1342,"wires":[["65331875.c56b48"]]},{"id":"61ad9239.eaf56c","type":"mnubo events","z":"62d4d30d.157ddc","name":"Objects Must Exist","mnuboconfig":"549b4ab6.77e814","functionselection":"send","inputtext":"","reportResults":false,"objectsMustExist":true,"x":419,"y":1382,"wires":[["65331875.c56b48"]]},{"id":"44a45130.5859d","type":"mnubo events","z":"62d4d30d.157ddc","name":"Both Flags On","mnuboconfig":"549b4ab6.77e814","functionselection":"send","inputtext":"","reportResults":true,"objectsMustExist":true,"x":409,"y":1422,"wires":[["4dce4415.d9995c","65331875.c56b48"]]},{"id":"bcfca29e.34141","type":"inject","z":"62d4d30d.157ddc","name":"","topic":"clean","payload":"[email protected]","payloadType":"none","repeat":"","crontab":"","once":false,"x":77,"y":1509,"wires":[["4dce4415.d9995c"]]},{"id":"3b863244.7d948e","type":"mnubo objects","z":"62d4d30d.157ddc","name":"","mnuboconfig":"549b4ab6.77e814","functionselection":"exists","inputtext":"","x":434.00000381469727,"y":1816.999948501587,"wires":[["e8263173.53dad"]]},{"id":"320a0b6b.afa5f4","type":"function","z":"62d4d30d.157ddc","name":"object1 exists?","func":"return {\"payload\": flow.get(\"mnubo_variables\").object1};","outputs":1,"noerr":0,"x":236.00000381469727,"y":1818.999948501587,"wires":[["3b863244.7d948e"]]},{"id":"85a39118.d9b66","type":"mnubo owners","z":"62d4d30d.157ddc","name":"","mnuboconfig":"549b4ab6.77e814","functionselection":"exists","inputtext":"","x":432.00000381469727,"y":1894.999948501587,"wires":[["fa54ac5d.f6837"]]},{"id":"fd33a695.379a78","type":"function","z":"62d4d30d.157ddc","name":"owner1 exists?","func":"return {\"payload\": flow.get(\"mnubo_variables\").owner1};","outputs":1,"noerr":0,"x":222.00000381469727,"y":1894.999948501587,"wires":[["85a39118.d9b66"]]},{"id":"5c4e8a4a.60b4d4","type":"switch","z":"62d4d30d.157ddc","name":"Fail/OK","property":"errors","propertyType":"msg","rules":[{"t":"nnull"},{"t":"null"}],"checkall":"true","repair":false,"outputs":2,"x":617,"y":218,"wires":[["87f7d975.df59d8"],["2b968d8e.010c52"]]},{"id":"cb30d6d4.d02468","type":"mnubo events","z":"62d4d30d.157ddc","name":"","mnuboconfig":"549b4ab6.77e814","functionselection":"sendfromdevice","inputtext":"[\n    \"node-red-device-auto1\", \n    [{\n\t\"x_event_type\": \"event_type_test\",\n\t\"x_timestamp\": \"2015-01-22T00:01:25-02:00\",\n\t\"x_latitude\": 57.876,\n\t\"x_longitude\": 57.876,\n\t\"temperature\": 15.2\n    }]\n]","reportResults":true,"objectsMustExist":false,"x":505,"y":1542,"wires":[["c63f44c0.84b448"]]},{"id":"e76a62e0.41818","type":"mnubo events","z":"62d4d30d.157ddc","name":"","mnuboconfig":"549b4ab6.77e814","functionselection":"sendfromdevice","inputtext":"[\n    \"node-red-device-auto1\", \n    [{\n\t\"x_event_type\": \"event_type_test\",\n\t\"x_timestamp\": \"2015-01-22T00:01:25-02:00\",\n\t\"x_latitude\": 57.876,\n\t\"x_longitude\": 57.876,\n\t\"temperature\": 15.2\n    }]\n]","reportResults":false,"objectsMustExist":true,"x":505,"y":1582,"wires":[["c63f44c0.84b448"]]},{"id":"bdf9f923.88bc08","type":"mnubo events","z":"62d4d30d.157ddc","name":"","mnuboconfig":"549b4ab6.77e814","functionselection":"sendfromdevice","inputtext":"[\n    \"node-red-device-auto1\", \n    [{\n\t\"x_event_type\": \"event_type_test\",\n\t\"x_timestamp\": \"2015-01-22T00:01:25-02:00\",\n\t\"x_latitude\": 57.876,\n\t\"x_longitude\": 57.876,\n\t\"temperature\": 15.2\n    }]\n]","reportResults":true,"objectsMustExist":true,"x":505,"y":1622,"wires":[["6fe9ffd7.fbcb7","c63f44c0.84b448"]]},{"id":"5af78e01.6d79b","type":"mnubo model","z":"62d4d30d.157ddc","name":"","mnuboconfig":"549b4ab6.77e814","functionselection":"createUpdateDataModel","inputtext":"{\n    \"objectTypes\": [\n        {\n            \"key\": \"car\",\n            \"displayName\": \"Car\",\n            \"description\": \"General\",\n            \"objectAttributes\": [\n                {\n                    \"key\": \"companyid\",\n                    \"displayName\": \"CompanyId\",\n                    \"description\": \"\",\n                    \"type\": {\n                        \"highLevelType\": \"INT\",\n                        \"containerType\": \"none\"\n                    }\n                },\n                {\n                    \"key\": \"unitname\",\n                    \"displayName\": \"\",\n                    \"description\": \"\",\n                    \"type\": {\n                        \"highLevelType\": \"TEXT\",\n                        \"containerType\": \"none\"\n                    }\n                }\n            ]\n        },\n        {\n            \"key\": \"truck\",\n            \"displayName\": \"12 wheels dump truck\",\n            \"description\": \"\",\n            \"objectAttributes\": [\n                {\n                    \"key\": \"companyid\",\n                    \"displayName\": \"CompanyId\",\n                    \"description\": \"\",\n                    \"type\": {\n                        \"highLevelType\": \"INT\",\n                        \"containerType\": \"none\"\n                    }\n                },\n                {\n                    \"key\": \"unitname\",\n                    \"displayName\": \"\",\n                    \"description\": \"\",\n                    \"type\": {\n                        \"highLevelType\": \"TEXT\",\n                        \"containerType\": \"none\"\n                    }\n                }\n            ]\n        }\n    ],\n    \"eventTypes\": [\n        {\n            \"key\": \"harsh_acceleration\",\n            \"displayName\": \"\",\n            \"description\": \"Harsh Acceleration\",\n            \"origin\": \"unscheduled\",\n            \"timeseries\": [\n                {\n                    \"key\": \"seatbelt_fastened_indicator\",\n                    \"displayName\": \"\",\n                    \"description\": \"\",\n                    \"type\": {\n                        \"highLevelType\": \"TEXT\"\n                    }\n                }\n            ]\n        },\n        {\n            \"key\": \"ignition_on\",\n            \"displayName\": \"\",\n            \"description\": \"Ignition off\",\n            \"origin\": \"unscheduled\",\n            \"timeseries\": []\n        },\n        {\n            \"key\": \"ignition_off\",\n            \"displayName\": \"\",\n            \"description\": \"Ignition off\",\n            \"origin\": \"unscheduled\",\n            \"timeseries\": []\n        }\n    ],\n    \"ownerAttributes\": [\n        {\n            \"key\": \"customername\",\n            \"displayName\": \"Customer Name\",\n            \"description\": \"\",\n            \"type\": {\n                \"highLevelType\": \"TEXT\",\n                \"containerType\": \"none\"\n            }\n        },\n        {\n            \"key\": \"inserteddate\",\n            \"displayName\": \"Created\",\n            \"description\": \"\",\n            \"type\": {\n                \"highLevelType\": \"DATETIME\",\n                \"containerType\": \"none\"\n            }\n        }\n    ]\n}","x":409,"y":620,"wires":[["907e69ef.cd7198"]]},{"id":"cb0b7a58.3ff258","type":"mnubo model","z":"62d4d30d.157ddc","name":"","mnuboconfig":"549b4ab6.77e814","functionselection":"getDataModel","inputtext":"{\n    \"objectTypes\": [],\n    \"eventTypes\": [\n        {\n            \"key\": \"test\",\n            \"displayName\": \"\",\n            \"description\": \"\",\n            \"origin\": \"unscheduled\",\n            \"timeseries\": [\n                {\n                    \"key\": \"test-ts\",\n                    \"displayName\": \"\",\n                    \"description\": \"\",\n                    \"type\": {\n                        \"highLevelType\": \"TEXT\"\n                    }\n                }\n            ]\n        },\n        {\n            \"key\": \"test-1\",\n            \"displayName\": \"\",\n            \"description\": \"\",\n            \"origin\": \"unscheduled\",\n            \"timeseries\": [\n                {\n                    \"key\": \"test-ts\",\n                    \"displayName\": \"\",\n                    \"description\": \"\",\n                    \"type\": {\n                        \"highLevelType\": \"TEXT\"\n                    }\n                }\n            ]\n        }\n    ],\n    \"ownerAttributes\": [],\n    \"sessionizers\": [],\n    \"orphans\": {},\n    \"tracked\": {\n        \"objectAttributes\": []\n    },\n    \"enrichers\": {},\n    \"reservedEnrichersFields\": []\n}","x":379,"y":740,"wires":[["98dc01d9.61157"]]},{"id":"d20c7088.0f8bb","type":"mnubo model","z":"62d4d30d.157ddc","name":"","mnuboconfig":"549b4ab6.77e814","functionselection":"getDataModel","inputtext":"{\n    \"objectTypes\": [],\n    \"eventTypes\": [\n        {\n            \"key\": \"test\",\n            \"displayName\": \"\",\n            \"description\": \"\",\n            \"origin\": \"unscheduled\",\n            \"timeseries\": [\n                {\n                    \"key\": \"test-ts\",\n                    \"displayName\": \"\",\n                    \"description\": \"\",\n                    \"type\": {\n                        \"highLevelType\": \"TEXT\"\n                    }\n                }\n            ]\n        },\n        {\n            \"key\": \"test-1\",\n            \"displayName\": \"\",\n            \"description\": \"\",\n            \"origin\": \"unscheduled\",\n            \"timeseries\": [\n                {\n                    \"key\": \"test-ts\",\n                    \"displayName\": \"\",\n                    \"description\": \"\",\n                    \"type\": {\n                        \"highLevelType\": \"TEXT\"\n                    }\n                }\n            ]\n        }\n    ],\n    \"ownerAttributes\": [],\n    \"sessionizers\": [],\n    \"orphans\": {},\n    \"tracked\": {\n        \"objectAttributes\": []\n    },\n    \"enrichers\": {},\n    \"reservedEnrichersFields\": []\n}","x":372,"y":403,"wires":[["9c932d5c.9603a"]]},{"id":"44a720bb.fba68","type":"function","z":"62d4d30d.157ddc","name":"","func":"return {\"payload\":\n    {\n    \"objectTypes\": [\n        {\n            \"key\": \"test\",\n            \"displayName\": \"test-object_type\",\n            \"description\": \"\",\n            \"objectAttributes\": [\n                {\n                    \"key\": \"color\",\n                    \"displayName\": \"Color\",\n                    \"description\": \"\",\n                    \"type\": {\n                        \"highLevelType\": \"TEXT\",\n                        \"containerType\": \"none\"\n                    }\n                }\n            ]\n        }\n    ],\n    \"eventTypes\": [\n        {\n            \"key\": \"measurement\",\n            \"displayName\": \"Measurement\",\n            \"description\": \"\",\n            \"origin\": \"unscheduled\",\n            \"timeseries\": [\n                {\n                    \"key\": \"temperature\",\n                    \"displayName\": \"\",\n                    \"description\": \"\",\n                    \"type\": {\n                        \"highLevelType\": \"FLOAT\"\n                    }\n                }\n            ]\n        }\n    ],\n    \"ownerAttributes\": [\n        {\n            \"key\": \"gender\",\n            \"displayName\": \"\",\n            \"description\": \"\",\n            \"type\": {\n                \"highLevelType\": \"TEXT\",\n                \"containerType\": \"none\"\n            }\n        },\n        {\n            \"key\": \"age\",\n            \"displayName\": \"\",\n            \"description\": \"\",\n            \"type\": {\n                \"highLevelType\": \"INT\",\n                \"containerType\": \"none\"\n            }\n        },\n    ],\n}\n};","outputs":1,"noerr":0,"x":169,"y":620,"wires":[["5af78e01.6d79b"]]},{"id":"41a38bae.cf7e14","type":"inject","z":"62d4d30d.157ddc","name":"","topic":"clean","payload":"[email protected]","payloadType":"none","repeat":"","crontab":"","once":false,"x":81,"y":546,"wires":[["44a720bb.fba68"]]},{"id":"93254f2c.b0a8","type":"mnubo model","z":"62d4d30d.157ddc","name":"","mnuboconfig":"549b4ab6.77e814","functionselection":"promoteDataModel","inputtext":"{\n  \"timeseries\": [\n    \"temperature\"\n  ],\n  \"objectAttributes\": [\n    \"color\"\n  ],\n  \"ownerAttributes\": [\n    \"gender\"\n  ]\n}","x":379,"y":820,"wires":[["bedecbaa.f1b5b8"]]},{"id":"55908b0e.d6bd44","type":"delay","z":"62d4d30d.157ddc","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":479,"y":680,"wires":[["cb0b7a58.3ff258"]]},{"id":"5bde2d3b.7b3674","type":"function","z":"62d4d30d.157ddc","name":"","func":"return {\n    \"payload\": {\n        \"timeseries\": [\n            \"temperature\"\n        ],\n        \"objectAttributes\": [\n            \"color\"\n        ],\n        \"ownerAttributes\": [\n                \"gender\"\n            ]\n    }\n};","outputs":1,"noerr":0,"x":169,"y":820,"wires":[["93254f2c.b0a8"]]},{"id":"aab0c94a.521fc8","type":"comment","z":"62d4d30d.157ddc","name":"This call will fails since there is not Production enviroment set up","info":"","x":458.33338928222656,"y":865.0000953674316,"wires":[]},{"id":"c6725c6e.730ea","type":"delay","z":"62d4d30d.157ddc","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":400,"y":500,"wires":[["44a720bb.fba68"]]},{"id":"9682ddf4.ea7a2","type":"comment","z":"62d4d30d.157ddc","name":"DATAMODEL","info":"","x":70,"y":500,"wires":[]},{"id":"84077daa.6ba15","type":"comment","z":"62d4d30d.157ddc","name":"INGESTION","info":"","x":70,"y":900,"wires":[]},{"id":"f691e3c8.3204","type":"comment","z":"62d4d30d.157ddc","name":"SEARCH","info":"","x":80,"y":1680,"wires":[]},{"id":"6f8d803a.c6c0d","type":"comment","z":"62d4d30d.157ddc","name":"CLEAN UP","info":"","x":60,"y":160,"wires":[]},{"id":"39c16b42.80c6d4","type":"debug","z":"62d4d30d.157ddc","name":"Error","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":781,"y":289,"wires":[]},{"id":"3da49ad8.931066","type":"debug","z":"62d4d30d.157ddc","name":"OK","active":true,"console":"false","complete":"payload","x":781,"y":321,"wires":[]},{"id":"52b214ae.5d1bec","type":"switch","z":"62d4d30d.157ddc","name":"Fail/OK","property":"errors","propertyType":"msg","rules":[{"t":"nnull"},{"t":"null"}],"checkall":"true","repair":false,"outputs":2,"x":615,"y":304,"wires":[["39c16b42.80c6d4"],["3da49ad8.931066"]]},{"id":"a7e6ff92.38a5e","type":"debug","z":"62d4d30d.157ddc","name":"Error","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":777,"y":389,"wires":[]},{"id":"956c80c0.dab67","type":"debug","z":"62d4d30d.157ddc","name":"OK","active":true,"console":"false","complete":"payload","x":777,"y":421,"wires":[]},{"id":"9c932d5c.9603a","type":"switch","z":"62d4d30d.157ddc","name":"Fail/OK","property":"errors","propertyType":"msg","rules":[{"t":"nnull"},{"t":"null"}],"checkall":"true","repair":false,"outputs":2,"x":611,"y":404,"wires":[["a7e6ff92.38a5e"],["956c80c0.dab67","c6725c6e.730ea"]]},{"id":"e11c47d1.e6c0d8","type":"debug","z":"62d4d30d.157ddc","name":"Error","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":767,"y":605,"wires":[]},{"id":"86cce5f7.009618","type":"debug","z":"62d4d30d.157ddc","name":"OK","active":true,"console":"false","complete":"payload","x":767,"y":637,"wires":[]},{"id":"907e69ef.cd7198","type":"switch","z":"62d4d30d.157ddc","name":"Fail/OK","property":"errors","propertyType":"msg","rules":[{"t":"nnull"},{"t":"null"}],"checkall":"true","repair":false,"outputs":2,"x":601,"y":620,"wires":[["e11c47d1.e6c0d8"],["86cce5f7.009618","55908b0e.d6bd44"]]},{"id":"686f9afe.51cb94","type":"debug","z":"62d4d30d.157ddc","name":"Error","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":764,"y":724,"wires":[]},{"id":"1ccf59ca.a0de36","type":"debug","z":"62d4d30d.157ddc","name":"OK","active":true,"console":"false","complete":"payload","x":764,"y":756,"wires":[]},{"id":"98dc01d9.61157","type":"switch","z":"62d4d30d.157ddc","name":"Fail/OK","property":"errors","propertyType":"msg","rules":[{"t":"nnull"},{"t":"null"}],"checkall":"true","repair":false,"outputs":2,"x":598,"y":739,"wires":[["686f9afe.51cb94"],["1ccf59ca.a0de36","5bde2d3b.7b3674"]]},{"id":"60307bc8.e69364","type":"debug","z":"62d4d30d.157ddc","name":"Error","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":767,"y":805,"wires":[]},{"id":"bb6cfe7.a9dc6","type":"debug","z":"62d4d30d.157ddc","name":"OK","active":true,"console":"false","complete":"payload","x":767,"y":837,"wires":[]},{"id":"bedecbaa.f1b5b8","type":"switch","z":"62d4d30d.157ddc","name":"Fail/OK","property":"errors","propertyType":"msg","rules":[{"t":"nnull"},{"t":"null"}],"checkall":"true","repair":false,"outputs":2,"x":601,"y":820,"wires":[["60307bc8.e69364","5e753cd4.3ff334"],["bb6cfe7.a9dc6"]]},{"id":"7943f198.de1aa","type":"debug","z":"62d4d30d.157ddc","name":"Error","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":769,"y":979,"wires":[]},{"id":"e97f3a5d.db4838","type":"debug","z":"62d4d30d.157ddc","name":"OK","active":true,"console":"false","complete":"payload","x":769,"y":1011,"wires":[]},{"id":"8c981039.bc8fa","type":"switch","z":"62d4d30d.157ddc","name":"Fail/OK","property":"errors","propertyType":"msg","rules":[{"t":"nnull"},{"t":"null"}],"checkall":"true","repair":false,"outputs":2,"x":603,"y":994,"wires":[["7943f198.de1aa"],["e97f3a5d.db4838","cb04c21a.42ae"]]},{"id":"8b1a47de.6fa488","type":"debug","z":"62d4d30d.157ddc","name":"Error","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":770,"y":1056,"wires":[]},{"id":"ca9fd19a.706b6","type":"debug","z":"62d4d30d.157ddc","name":"OK","active":true,"console":"false","complete":"payload","x":770,"y":1088,"wires":[]},{"id":"8e077b9f.7792d8","type":"switch","z":"62d4d30d.157ddc","name":"Fail/OK","property":"errors","propertyType":"msg","rules":[{"t":"nnull"},{"t":"null"}],"checkall":"true","repair":false,"outputs":2,"x":604,"y":1071,"wires":[["8b1a47de.6fa488"],["ca9fd19a.706b6","2db7e0dc.696e"]]},{"id":"cd947512.4c6678","type":"debug","z":"62d4d30d.157ddc","name":"Error","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":768,"y":1141,"wires":[]},{"id":"7cb00c7e.c99604","type":"debug","z":"62d4d30d.157ddc","name":"OK","active":true,"console":"false","complete":"payload","x":768,"y":1173,"wires":[]},{"id":"92bd0647.9f9238","type":"switch","z":"62d4d30d.157ddc","name":"Fail/OK","property":"errors","propertyType":"msg","rules":[{"t":"nnull"},{"t":"null"}],"checkall":"true","repair":false,"outputs":2,"x":602,"y":1156,"wires":[["cd947512.4c6678"],["7cb00c7e.c99604","8c591651.dc9a98"]]},{"id":"3c88dfa5.cebc9","type":"debug","z":"62d4d30d.157ddc","name":"Error","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":766,"y":1216,"wires":[]},{"id":"581c2dec.fb2a04","type":"debug","z":"62d4d30d.157ddc","name":"OK","active":true,"console":"false","complete":"payload","x":766,"y":1248,"wires":[]},{"id":"c5dec142.ce23e","type":"switch","z":"62d4d30d.157ddc","name":"Fail/OK","property":"errors","propertyType":"msg","rules":[{"t":"nnull"},{"t":"null"}],"checkall":"true","repair":false,"outputs":2,"x":600,"y":1231,"wires":[["3c88dfa5.cebc9"],["581c2dec.fb2a04","a9eb87b4.a8d918"]]},{"id":"4cb047a3.991b68","type":"debug","z":"62d4d30d.157ddc","name":"Error","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":769,"y":1338,"wires":[]},{"id":"13163f35.dee4a1","type":"debug","z":"62d4d30d.157ddc","name":"OK","active":true,"console":"false","complete":"payload","x":769,"y":1370,"wires":[]},{"id":"65331875.c56b48","type":"switch","z":"62d4d30d.157ddc","name":"Fail/OK","property":"errors","propertyType":"msg","rules":[{"t":"nnull"},{"t":"null"}],"checkall":"true","repair":false,"outputs":2,"x":603,"y":1353,"wires":[["4cb047a3.991b68"],["13163f35.dee4a1"]]},{"id":"b5455f87.0b423","type":"debug","z":"62d4d30d.157ddc","name":"Error","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":873,"y":1546,"wires":[]},{"id":"135f3187.3edd8e","type":"debug","z":"62d4d30d.157ddc","name":"OK","active":true,"console":"false","complete":"payload","x":873,"y":1578,"wires":[]},{"id":"c63f44c0.84b448","type":"switch","z":"62d4d30d.157ddc","name":"Fail/OK","property":"errors","propertyType":"msg","rules":[{"t":"nnull"},{"t":"null"}],"checkall":"true","repair":false,"outputs":2,"x":707,"y":1561,"wires":[["b5455f87.0b423"],["135f3187.3edd8e"]]},{"id":"5cc0a113.e4bd","type":"debug","z":"62d4d30d.157ddc","name":"Error","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":763.0000038146973,"y":1723.999948501587,"wires":[]},{"id":"25275580.8cd42a","type":"debug","z":"62d4d30d.157ddc","name":"OK","active":true,"console":"false","complete":"payload","x":763.0000038146973,"y":1755.999948501587,"wires":[]},{"id":"26d284bf.43c5cc","type":"switch","z":"62d4d30d.157ddc","name":"Fail/OK","property":"errors","propertyType":"msg","rules":[{"t":"nnull"},{"t":"null"}],"checkall":"true","repair":false,"outputs":2,"x":597.0000038146973,"y":1738.999948501587,"wires":[["5cc0a113.e4bd"],["25275580.8cd42a","320a0b6b.afa5f4"]]},{"id":"f79f3de8.de3c7","type":"debug","z":"62d4d30d.157ddc","name":"Error","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":764.0000038146973,"y":1801.999948501587,"wires":[]},{"id":"a62724ef.2fc318","type":"debug","z":"62d4d30d.157ddc","name":"OK","active":true,"console":"false","complete":"payload","x":764.0000038146973,"y":1833.999948501587,"wires":[]},{"id":"e8263173.53dad","type":"switch","z":"62d4d30d.157ddc","name":"Fail/OK","property":"errors","propertyType":"msg","rules":[{"t":"nnull"},{"t":"null"}],"checkall":"true","repair":false,"outputs":2,"x":598.0000038146973,"y":1816.999948501587,"wires":[["f79f3de8.de3c7"],["a62724ef.2fc318","fd33a695.379a78"]]},{"id":"344ca8f5.66e7f8","type":"debug","z":"62d4d30d.157ddc","name":"Error","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":766.0000038146973,"y":1879.999948501587,"wires":[]},{"id":"1c9b1782.c72558","type":"debug","z":"62d4d30d.157ddc","name":"OK","active":true,"console":"false","complete":"payload","x":766.0000038146973,"y":1911.999948501587,"wires":[]},{"id":"fa54ac5d.f6837","type":"switch","z":"62d4d30d.157ddc","name":"Fail/OK","property":"errors","propertyType":"msg","rules":[{"t":"nnull"},{"t":"null"}],"checkall":"true","repair":false,"outputs":2,"x":600.0000038146973,"y":1894.999948501587,"wires":[["344ca8f5.66e7f8"],["1c9b1782.c72558","d5c011f3.87b0b"]]},{"id":"cdd33037.3ef63","type":"function","z":"62d4d30d.157ddc","name":"Clear MSG","func":"return {\"payload\": null};","outputs":1,"noerr":0,"x":130,"y":400,"wires":[["d20c7088.0f8bb"]]},{"id":"e1bd8fac.9252d","type":"debug","z":"62d4d30d.157ddc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":560,"y":2020,"wires":[]},{"id":"d5c011f3.87b0b","type":"function","z":"62d4d30d.157ddc","name":"DONE","func":"\nreturn {\"payload\": \"DONE\"};","outputs":1,"noerr":0,"x":380,"y":2020,"wires":[["e1bd8fac.9252d"]]},{"id":"bafca31d.4751f","type":"comment","z":"62d4d30d.157ddc","name":"It may fail the fist time you run it, since the objects is not created... ","info":"","x":580,"y":266,"wires":[]},{"id":"b2a959bb.791068","type":"comment","z":"62d4d30d.157ddc","name":"It may fail the fist time you run it, since the owner is not created...","info":"","x":570,"y":351,"wires":[]},{"id":"549b4ab6.77e814","type":"mnubo config","z":"","name":"integration-APP TOKEN","env":"sandbox","proxy_url":"https://integration.sandbox.1.mnubo.com","credentials_type":"app_token","retries":true,"numberOfAttempts":"5","initialDelayInMillis":"500"}]

Example 2: Different Flows

``` [{"id":"5c61c927.4ad558","type":"tab","label":"Authentication"},{"id":"892d6ac6.a94368","type":"tab","label":"Owner","disabled":false},{"id":"7ac1bef6.f9eb","type":"tab","label":"Objects","disabled":false,"info":""},{"id":"280846cf.8ae8da","type":"tab","label":"Events"},{"id":"6a9b76a5.686cb8","type":"subflow","name":"Subflow 1","info":"","in":[],"out":[]},{"id":"58a329f3.b19578","type":"subflow","name":"Subflow 2","info":"","in":[{"x":50,"y":30,"wires":[]}],"out":[]},{"id":"a5256874.0a7af8","type":"subflow","name":"Subflow 1 (2)","info":"","in":[],"out":[]},{"id":"215506dc.88ecba","type":"subflow","name":"Subflow 2 (2)","info":"","in":[{"x":50,"y":30,"wires":[]}],"out":[]},{"id":"7e770dbf.06e484","type":"mnubo config","z":"","name":"Integration","env":"sandbox","proxy_url":"","credentials_type":"client_credentials","retries":false,"numberOfAttempts":"5","initialDelayInMillis":"500"},{"id":"91db3002.c15a5","type":"mqtt-broker","z":"","broker":"","port":"1883","tls":"","clientid":"","usetls":true,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"19a3eccd.899c33","type":"mnubo config","z":"","name":"dataflow","env":"useproxyurl","proxy_url":"https://dataflow.sandbox.1.mnubo.com","credentials_type":"client_credentials","retries":true,"numberOfAttempts":"5","initialDelayInMillis":"500"},{"id":"925bd588.43e258","type":"mnubo config","z":"","name":"integration-APP TOKEN","env":"sandbox","proxy_url":"https://integration.sandbox.1.mnubo.com","credentials_type":"app_token","retries":true,"numberOfAttempts":"5","initialDelayInMillis":"500"},{"id":"b49110c8.5bc37","type":"mnubo auth","z":"5c61c927.4ad558","name":"Get Token","mnuboconfig":"7e770dbf.06e484","x":170,"y":40,"wires":[["ecbe5800.2f8428"]]},{"id":"a378ff96.49f92","type":"function","z":"5c61c927.4ad558","name":"set global env","func":"//Global Variables share by all functions in the diferents Flows\nglobal.set("mnubo_variables", {\n "mnubo1": {\n "owner": "node-red-owner-1@test.com",\n "object": "node-red-device-1"\n },\n "mnubo2": {\n "owner": "node-red-owner-2@test.com",\n "object": "node-red-device-2"\n },\n "mnubo3": {\n "owner": "node-red-owner-3@test.com",\n "object": "node-red-device-3"\n },\n "mnubo4": {\n "owner": "node-red-owner-4@test.com",\n "object": "node-red-device-4"\n },\n "mnubo5": {\n "owner": "node-red-owner-5@test.com",\n "object": "node-red-device-5"\n },\n "mnubo6": {\n "owner": "node-red-owner-6@test.com",\n "object": "node-red-device-6"\n },\n});\n\nreturn msg;","outputs":1,"noerr":0,"x":539.75,"y":109.75,"wires":[["88e90676.e1d738"]]},{"id":"ecbe5800.2f8428","type":"switch","z":"5c61c927.4ad558","name":"Token != Bearer","property":"errors","propertyType":"msg","rules":[{"t":"nnull"},{"t":"null"}],"checkall":"true","outputs":2,"x":343.5,"y":40,"wires":[["cc316f26.9f23"],["a378ff96.49f92"]]},{"id":"cc316f26.9f23","type":"debug","z":"5c61c927.4ad558","name":"Error","active":true,"console":"false","complete":"errors","x":524.5,"y":18,"wires":[]},{"id":"ed141012.5ef56","type":"inject","z":"5c61c927.4ad558","name":"Start Here","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"x":170.88889122009277,"y":107.33333778381348,"wires":[["a378ff96.49f92"]]},{"id":"cabfc12e.48066","type":"link in","z":"7ac1bef6.f9eb","name":"Object - From Owner","links":["7b2c4be9.59fe94"],"x":36.11111259460449,"y":55.5555534362793,"wires":[["5c0a23c8.3bc34c"]]},{"id":"5d94d501.96c0bc","type":"function","z":"7ac1bef6.f9eb","name":"Single Creation","func":"return {"payload": global.get("mnubo_variables").mnubo1.object};","outputs":1,"noerr":0,"x":233.3333282470703,"y":84.4444375038147,"wires":[["a4cb37fb.bba098"]]},{"id":"48509967.3ec6f8","type":"comment","z":"7ac1bef6.f9eb","name":"Single Creation","info":"","x":100,"y":20,"wires":[]},{"id":"267040a8.26b28","type":"comment","z":"7ac1bef6.f9eb","name":"Bulk Creation","info":"","x":81.11111450195312,"y":184.4444456100464,"wires":[]},{"id":"f92c7967.5c9788","type":"comment","z":"7ac1bef6.f9eb","name":"Single Update","info":"","x":90,"y":460,"wires":[]},{"id":"c83b6268.8e3a8","type":"comment","z":"7ac1bef6.f9eb","name":"Bulk Update","info":"","x":90,"y":620,"wires":[]},{"id":"ca17d8a6.284d58","type":"function","z":"7ac1bef6.f9eb","name":"Bulk Creation (Ok)","func":"return {"payload": [global.get("mnubo_variables").mnubo2.object, global.get("mnubo_variables").mnubo3.object]};","outputs":1,"noerr":0,"x":130,"y":220,"wires":[["e6d54e13.2404d"]]},{"id":"b77de4a0.2043b8","type":"function","z":"7ac1bef6.f9eb","name":"Single Update","func":"return {"payload": [\n global.get("mnubo_variables").mnubo1.object, \n {"x_object_type": "trunk"}\n ]\n};","outputs":1,"noerr":0,"x":100,"y":540,"wires":[["63140a7b.64d304"]]},{"id":"b263c8d6.d419f8","type":"link in","z":"280846cf.8ae8da","name":"Events - Entry Point","links":["60782365.fdc3fc"],"x":15,"y":140,"wires":[["8f1cbada.fef3d8"]]},{"id":"e5ff2470.d982c8","type":"mnubo events","z":"280846cf.8ae8da","name":"Default","mnuboconfig":"7e770dbf.06e484","functionselection":"send","inputtext":"","reportResults":false,"objectsMustExist":false,"x":660,"y":100,"wires":[["d5bb22f8.c08db"]]},{"id":"8f12d93c.202c68","type":"comment","z":"280846cf.8ae8da","name":"EVENT","info":"","x":70,"y":40,"wires":[]},{"id":"6a12447c.4f424c","type":"function","z":"280846cf.8ae8da","name":"Single Events (Ok)","func":"\nreturn {"payload": [{\n "x_object": {"x_device_id": global.get("mnubo_variables").mnubo1.object },\n "x_event_type": "engine_start",\n "x_timestamp": new Date().toISOString(),\n }]\n};","outputs":1,"noerr":0,"x":230,"y":200,"wires":[["e5ff2470.d982c8","37e1892e.2bc346","31a98f1f.b2136","b1e1b950.2bec68"]]},{"id":"d3bfa7f6.7c1148","type":"mnubo events","z":"280846cf.8ae8da","name":"Report Results","mnuboconfig":"7e770dbf.06e484","functionselection":"send","inputtext":"","reportResults":true,"objectsMustExist":false,"x":682,"y":155,"wires":[["d5bb22f8.c08db"]]},{"id":"9f2e2254.261dc","type":"mnubo events","z":"280846cf.8ae8da","name":"Objects Must Exist","mnuboconfig":"7e770dbf.06e484","functionselection":"send","inputtext":"","reportResults":false,"objectsMustExist":true,"x":690,"y":201,"wires":[["d5bb22f8.c08db"]]},{"id":"38c770af.f1d49","type":"mnubo events","z":"280846cf.8ae8da","name":"Both Flags On","mnuboconfig":"7e770dbf.06e484","functionselection":"send","inputtext":"","reportResults":true,"objectsMustExist":true,"x":680,"y":246,"wires":[["d5bb22f8.c08db","1715ede0.865d82"]]},{"id":"d8e42a84.0811b8","type":"inject","z":"280846cf.8ae8da","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"x":90,"y":240,"wires":[["6a12447c.4f424c"]]},{"id":"37e1892e.2bc346","type":"delay","z":"280846cf.8ae8da","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":494.5,"y":155,"wires":[["d3bfa7f6.7c1148"]]},{"id":"31a98f1f.b2136","type":"delay","z":"280846cf.8ae8da","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":500,"y":202,"wires":[["9f2e2254.261dc"]]},{"id":"b1e1b950.2bec68","type":"delay","z":"280846cf.8ae8da","name":"","pauseType":"delay","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":500,"y":247,"wires":[["38c770af.f1d49"]]},{"id":"12794563.63fa4b","type":"mnubo analytics","z":"280846cf.8ae8da","name":"Seach Query","mnuboconfig":"7e770dbf.06e484","searchtype":"SearchQuery","inputquery":"","x":547.6666717529297,"y":2362.0000133514404,"wires":[["bca571ec.f8073"]]},{"id":"c563ed6c.88bb7","type":"function","z":"280846cf.8ae8da","name":"Count Events","func":"\nreturn {"payload": \n {\n "from": "event",\n "select": [{\n "count": "*"\n }]\n }\n};","outputs":1,"noerr":0,"x":316.8888969421387,"y":2361.1111488342285,"wires":[["12794563.63fa4b"]]},{"id":"838e165.03f25e8","type":"comment","z":"280846cf.8ae8da","name":"SEARCH","info":"","x":105,"y":2321,"wires":[]},{"id":"47c08a.4b35ff78","type":"inject","z":"280846cf.8ae8da","name":"Start Here","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"x":120,"y":2540,"wires":[["c563ed6c.88bb7","40487989.8c6578","78cfe36a.62ba1c"]]},{"id":"87db74eb.50f058","type":"mnubo analytics","z":"280846cf.8ae8da","name":"Get DataModel","mnuboconfig":"7e770dbf.06e484","searchtype":"getDataModel","inputquery":"","x":539.8888959884644,"y":2446.4446630477905,"wires":[["29774dfa.36d532"]]},{"id":"93d5f210.8f0fb","type":"mnubo analytics","z":"280846cf.8ae8da","name":"Get Dataset","mnuboconfig":"7e770dbf.06e484","searchtype":"getDatasets","inputquery":"","x":529.5555725097656,"y":2538.888997077942,"wires":[["b2e4f082.2e435"]]},{"id":"40487989.8c6578","type":"delay","z":"280846cf.8ae8da","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":336.44444274902344,"y":2446.777970314026,"wires":[["87db74eb.50f058"]]},{"id":"78cfe36a.62ba1c","type":"delay","z":"280846cf.8ae8da","name":"","pauseType":"delay","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":336.66666412353516,"y":2537.7776622772217,"wires":[["93d5f210.8f0fb"]]},{"id":"aa83f51f.7d4578","type":"inject","z":"7ac1bef6.f9eb","name":"Start Here","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"x":100,"y":140,"wires":[["5d94d501.96c0bc"]]},{"id":"45704535.0259bc","type":"function","z":"892d6ac6.a94368","name":"Single Creation","func":"msg.payload = global.get("mnubo_variables").mnubo1.owner;\nreturn msg;","outputs":1,"noerr":0,"x":155,"y":99,"wires":[["7884f8b.4949508"]]},{"id":"7884f8b.4949508","type":"mnubo owners","z":"892d6ac6.a94368","name":"Exists","mnuboconfig":"925bd588.43e258","functionselection":"exists","inputtext":"owner-1","x":330,"y":100,"wires":[["6cfb3f8d.57035"]]},{"id":"f01ff96.6f5dd08","type":"link in","z":"892d6ac6.a94368","name":"Owner - Entry Point","links":["88e90676.e1d738"],"x":35,"y":60,"wires":[["792558f8.541028"]]},{"id":"21558241.8eaabe","type":"comment","z":"892d6ac6.a94368","name":"Single Creation","info":"","x":80,"y":20,"wires":[]},{"id":"a0b72e3f.36cce","type":"comment","z":"892d6ac6.a94368","name":"Bulk Creation","info":"","x":90,"y":180,"wires":[]},{"id":"80fb1e9.83ba1e","type":"comment","z":"892d6ac6.a94368","name":"Single Update","info":"","x":70,"y":440,"wires":[]},{"id":"e5153f03.12874","type":"comment","z":"892d6ac6.a94368","name":"Bulk Update","info":"","x":70,"y":580,"wires":[]},{"id":"4aa5cba.2930634","type":"function","z":"892d6ac6.a94368","name":"Bulk Creation (Ok)","func":"msg.payload = [global.get("mnubo_variables").mnubo2.owner, global.get("mnubo_variables").mnubo3.owner];\n\nreturn msg;","outputs":1,"noerr":0,"x":176.5,"y":216.5555362701416,"wires":[["9f2b8a00.6f1428"]]},{"id":"6a79db3f.dfd764","type":"function","z":"892d6ac6.a94368","name":"Single Update","func":"return {"payload":[\n global.get("mnubo_variables").mnubo1.owner, \n {\n "age": 21,\n 'x_timestamp': new Date().toISOString()\n }\n ]\n};","outputs":1,"noerr":0,"x":140,"y":520,"wires":[["3e9fc547.30636a"]]},{"id":"2b408540.0d607a","type":"function","z":"892d6ac6.a94368","name":"Bulk Update (Ok)","func":"msg.payload = [\n {\n "username": global.get("mnubo_variables").mnubo2.owner,\n "age": 52,\n 'x_timestamp': new Date().toISOString()\n },\n {\n "username": global.get("mnubo_variables").mnubo3.owner,\n "age": 29,\n 'x_timestamp': new Date().toISOString()\n }\n];\nreturn msg;\n","outputs":1,"noerr":0,"x":110,"y":640,"wires":[["a1d76d00.cf778"]]},{"id":"3e9fc547.30636a","type":"mnubo owners","z":"892d6ac6.a94368","name":"Update","mnuboconfig":"7e770dbf.06e484","functionselection":"update","inputtext":"","x":320,"y":520,"wires":[["4fc2224c.8d943c"]]},{"id":"89a9557c.748b68","type":"function","z":"892d6ac6.a94368","name":"Bulk Update (Multiple Status)","func":"msg.payload = [{\n "username": global.get("mnubo_variables").mnubo4.owner,\n "gender": "male",\n 'x_timestamp': new Date().toISOString()\n},\n{\n "username": global.get("mnubo_variables").mnubo5.owner,\n "age": 35,\n 'x_timestamp': new Date().toISOString()\n}\n];\nreturn msg;\n","outputs":1,"noerr":0,"x":140,"y":720,"wires":[["fed431f2.0a8c5"]]},{"id":"c3bdbcfb.1068f","type":"comment","z":"892d6ac6.a94368","name":"Single Claim","info":"","x":70,"y":860,"wires":[]},{"id":"eef8aae5.5035e8","type":"comment","z":"892d6ac6.a94368","name":"Bulk Claim","info":"","x":60,"y":1040,"wires":[]},{"id":"fec8e7d0.0cd178","type":"function","z":"892d6ac6.a94368","name":"Single Claim","func":"return {\n "payload": [global.get("mnubo_variables").mnubo1.owner, global.get("mnubo_variables").mnubo1.object ]\n};","outputs":1,"noerr":0,"x":190,"y":940,"wires":[["a3df9ec3.4a44c"]]},{"id":"a3df9ec3.4a44c","type":"mnubo owners","z":"892d6ac6.a94368","name":"Claim","mnuboconfig":"7e770dbf.06e484","functionselection":"claim","inputtext":"","x":430,"y":940,"wires":[["dc681bf8.68af18"]]},{"id":"1d28b64a.9d43ea","type":"inject","z":"892d6ac6.a94368","name":"Start Here","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"x":80,"y":140,"wires":[["45704535.0259bc"]]},{"id":"1b1a4a3a.53b2e6","type":"inject","z":"892d6ac6.a94368","name":"Start Here","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"x":80,"y":480,"wires":[["6a79db3f.dfd764"]]},{"id":"4185acf4.bdaae4","type":"function","z":"892d6ac6.a94368","name":"exists?","func":"if (msg.payload[global.get("mnubo_variables").mnubo1.owner]) {\n return [msg, null]\n}\nelse {\n return [null, {\n "payload": {\n "username": global.get("mnubo_variables").mnubo1.owner,\n }\n }]\n}","outputs":2,"noerr":0,"x":600,"y":100,"wires":[["33f107ab.eef1b8"],["24a5c228.871dce"]],"outputLabels":["Alredy exists","Does not exists"]},{"id":"6cfb3f8d.57035","type":"switch","z":"892d6ac6.a94368","name":"Fail/OK","property":"errors","propertyType":"msg","rules":[{"t":"nnull"},{"t":"null"}],"checkall":"true","repair":false,"outputs":2,"x":460,"y":99,"wires":[["bfa0be9.d6d164"],["4185acf4.bdaae4"]]},{"id":"bfa0be9.d6d164","type":"debug","z":"892d6ac6.a94368","name":"Error","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"errors","x":570,"y":20,"wires":[]},{"id":"24a5c228.871dce","type":"mnubo owners","z":"892d6ac6.a94368","name":"Create","mnuboconfig":"7e770dbf.06e484","functionselection":"create","inputtext":"[\n {"username": "mnubo5.owner",\n "x_password": "MnuboDummyPassword"\n },\n {"username": "mnubo6.owner",\n "x_password": "MnuboDummyPassword",\n "gender": "male"\n }]","x":750,"y":102,"wires":[["6c407046.5198f"]]},{"id":"33f107ab.eef1b8","type":"debug","z":"892d6ac6.a94368","name":" Owner Exists","active":true,"tosidebar":true,"console":false,"complete":"payload","x":750,"y":20,"wires":[]},{"id":"6c407046.5198f","type":"switch","z":"892d6ac6.a94368","name":"Fail/OK","property":"errors","propertyType":"msg","rules":[{"t":"nnull"},{"t":"null"}],"checkall":"true","repair":false,"outputs":2,"x":880,"y":102,"wires":[["ff6695d0.8f6d88"],["9bf6b1f4.2bc69","4aa5cba.2930634"]]},{"id":"ff6695d0.8f6d88","type":"debug","z":"892d6ac6.a94368","name":"Error","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"errors","x":990,"y":20,"wires":[]},{"id":"9bf6b1f4.2bc69","type":"debug","z":"892d6ac6.a94368","name":"OK","active":true,"console":"false","complete":"payload","x":1030,"y":100,"wires":[]},{"id":"9f2b8a00.6f1428","type":"mnubo owners","z":"892d6ac6.a94368","name":"Exists","mnuboconfig":"7e770dbf.06e484","functionselection":"exists","inputtext":"owner-1","x":365,"y":218.2222137451172,"wires":[["664d6b22.9f2ea4"]]},{"id":"664d6b22.9f2ea4","type":"switch","z":"892d6ac6.a94368","name":"Fail/OK","property":"errors","propertyType":"msg","rules":[{"t":"nnull"},{"t":"null"}],"checkall":"true","repair":false,"outputs":2,"x":495,"y":218.2222137451172,"wires":[["6538bab5.5ba064"],["bd1a24e5.aeff58"]],"outputLabels":["Error","Ok"]},{"id":"6538bab5.5ba064","type":"debug","z":"892d6ac6.a94368","name":"Error","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"errors","x":605,"y":182.2222137451172,"wires":[]},{"id":"50b99721.a67ba8","type":"function","z":"892d6ac6.a94368","name":"Bulk Creation (Multi Status)","func":"msg.payload = [global.get("mnubo_variables").mnubo4.owner, global.get("mnubo_variables").mnubo5.owner];\n\nreturn msg;","outputs":1,"noerr":0,"x":175,"y":302.2222137451172,"wires":[["a3bc2898.84ecb8"]]},{"id":"a3bc2898.84ecb8","type":"mnubo owners","z":"892d6ac6.a94368","name":"Exists","mnuboconfig":"7e770dbf.06e484","functionselection":"exists","inputtext":"owner-1","x":373.5,"y":303.8888912200928,"wires":[["9ce49aee.162bd8"]]},{"id":"9ce49aee.162bd8","type":"switch","z":"892d6ac6.a94368","name":"Fail/OK","property":"errors","propertyType":"msg","rules":[{"t":"nnull"},{"t":"null"}],"checkall":"true","repair":false,"outputs":2,"x":503.5,"y":303.8888912200928,"wires":[["2d142ea6.38b242"],["f73ab1f6.fff89"]]},{"id":"2d142ea6.38b242","type":"debug","z":"892d6ac6.a94368","name":"Error","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"errors","x":613.5,"y":267.8888912200928,"wires":[]},{"id":"bd1a24e5.aeff58","type":"function","z":"892d6ac6.a94368","name":"Create Body","func":"var owner_to_create = [];\n\nmsg.payload.forEach((el, index) => {\n owner_to_create.push(\n {\n 'username': Object.keys(el)[0],\n 'x_password': "MnuboDummyPassword",\n 'x_registration_date': new Date().toISOString()\n });\n})\n\nreturn {"payload": owner_to_create}","outputs":1,"noerr":0,"x":653,"y":225.2222137451172,"wires":[["aa19b6d2.c2cac8"]]},{"id":"aa19b6d2.c2cac8","type":"mnubo owners","z":"892d6ac6.a94368","name":"Create","mnuboconfig":"7e770dbf.06e484","functionselection":"create","inputtext":"[\n {"username": "mnubo5.owner",\n "x_password": "MnuboDummyPassword"\n },\n {"username": "mnubo6.owner",\n "x_password": "MnuboDummyPassword",\n "gender": "male"\n }]","x":819,"y":226.2222137451172,"wires":[["345c5099.c193e"]]},{"id":"345c5099.c193e","type":"switch","z":"892d6ac6.a94368","name":"Fail/OK","property":"errors","propertyType":"msg","rules":[{"t":"nnull"},{"t":"null"}],"checkall":"true","repair":false,"outputs":2,"x":949,"y":226.2222137451172,"wires":[["fc843ae8.57e648"],["f8c19d67.5028f","50b99721.a67ba8"]]},{"id":"fc843ae8.57e648","type":"debug","z":"892d6ac6.a94368","name":"Error","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1079,"y":204.2222137451172,"wires":[]},{"id":"f8c19d67.5028f","type":"debug","z":"892d6ac6.a94368","name":"OK","active":true,"console":"false","complete":"payload","x":1079,"y":244.2222137451172,"wires":[]},{"id":"f73ab1f6.fff89","type":"function","z":"892d6ac6.a94368","name":"Create Body","func":"var owner_to_create = [];\n\nmsg.payload.forEach((el, index) => {\n if (index) {\n owner_to_create.push(\n {\n 'username': Object.keys(el)[0],\n 'x_password': "MnuboDummyPassword",\n 'x_registration_date': new Date().toISOString()\n })\n \n } else { //Build one bad request\n owner_to_create.push(\n {\n 'username': Object.keys(el)[0],\n 'x_registration_date': new Date().toISOString(),\n 'gender': "male"\n })\n }\n})\n\nreturn {"payload": owner_to_create}","outputs":1,"noerr":0,"x":656,"y":310.2222137451172,"wires":[["f1c0d5e7.f85b58"]]},{"id":"f1c0d5e7.f85b58","type":"mnubo owners","z":"892d6ac6.a94368","name":"Create","mnuboconfig":"7e770dbf.06e484","functionselection":"create","inputtext":"[\n {"username": "mnubo5.owner",\n "x_password": "MnuboDummyPassword"\n },\n {"username": "mnubo6.owner",\n "x_password": "MnuboDummyPassword",\n "gender": "male"\n }]","x":824,"y":309.2222137451172,"wires":[["8aa6d926.0c35d8"]]},{"id":"8aa6d926.0c35d8","type":"switch","z":"892d6ac6.a94368","name":"Fail/OK","property":"errors","propertyType":"msg","rules":[{"t":"nnull"},{"t":"null"}],"checkall":"true","repair":false,"outputs":2,"x":954,"y":309.2222137451172,"wires":[["d8038f7e.ca49f","1aa87fcd.b830d"],["113a417a.5cb32f"]]},{"id":"d8038f7e.ca49f","type":"debug","z":"892d6ac6.a94368","name":"Error","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"errors","x":1084,"y":287.2222137451172,"wires":[]},{"id":"113a417a.5cb32f","type":"debug","z":"892d6ac6.a94368","name":"OK","active":true,"console":"false","complete":"payload","x":1084,"y":327.2222137451172,"wires":[]},{"id":"4fc2224c.8d943c","type":"switch","z":"892d6ac6.a94368","name":"Fail/OK","property":"errors","propertyType":"msg","rules":[{"t":"nnull"},{"t":"null"}],"checkall":"true","repair":false,"outputs":2,"x":480,"y":520,"wires":[["f9a72f87.8f571"],["a2dd9a32.d06398","2b408540.0d607a"]]},{"id":"f9a72f87.8f571","type":"debug","z":"892d6ac6.a94368","name":"Error","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"errors","x":610,"y":498,"wires":[]},{"id":"a2dd9a32.d06398","type":"debug","z":"892d6ac6.a94368","name":"OK","active":true,"console":"false","complete":"payload","x":610,"y":538,"wires":[]},{"id":"42951959.70fc28","type":"switch","z":"892d6ac6.a94368","name":"Fail/OK","property":"errors","propertyType":"msg","rules":[{"t":"nnull"},{"t":"null"}],"checkall":"true","repair":false,"outputs":2,"x":480,"y":640,"wires":[["ddaacc8e.83d46"],["ff165acd.b7a2b8","89a9557c.748b68"]]},{"id":"ddaacc8e.83d46","type":"debug","z":"892d6ac6.a94368","name":"Error","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"errors","x":610,"y":618,"wires":[]},{"id":"ff165acd.b7a2b8","type":"debug","z":"892d6ac6.a94368","name":"OK","active":true,"console":"false","complete":"payload","x":610,"y":658,"wires":[]},{"id":"a1d76d00.cf778","type":"mnubo owners","z":"892d6ac6.a94368","name":"Update","mnuboconfig":"7e770dbf.06e484","functionselection":"update","inputtext":"","x":320,"y":640,"wires":[["42951959.70fc28"]]},{"id":"ccc1ea8c.8044e8","type":"switch","z":"892d6ac6.a94368","name":"Fail/OK","property":"errors","propertyType":"msg","rules":[{"t":"nnull"},{"t":"null"}],"checkall":"true","repair":false,"outputs":2,"x":540,"y":720,"wires":[["4a805b8.4863ea4","c0dfc92c.6ad478"],["ff7acf91.77a0a"]]},{"id":"4a805b8.4863ea4","type":"debug","z":"892d6ac6.a94368","name":"Error","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"errors","x":670,"y":698,"wires":[]},{"id":"ff7acf91.77a0a","type":"debug","z":"892d6ac6.a94368","name":"OK","active":true,"console":"false","complete":"payload","x":670,"y":738,"wires":[]},{"id":"fed431f2.0a8c5","type":"mnubo owners","z":"892d6ac6.a94368","name":"Update","mnuboconfig":"7e770dbf.06e484","functionselection":"update","inputtext":"","x":380,"y":720,"wires":[["ccc1ea8c.8044e8"]]},{"id":"185499ba.b8f5c6","type":"inject","z":"892d6ac6.a94368","name":"Start Here","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"x":80,"y":980,"wires":[["fec8e7d0.0cd178"]]},{"id":"c0dfc92c.6ad478","type":"function","z":"892d6ac6.a94368","name":"Bulk Update (All Fail)","func":"return {"payload":[\n {\n "username": global.get("mnubo_variables").mnubo4.owner,\n "gender": "male",\n 'x_timestamp': new Date().toISOString()\n },\n {\n "username": global.get("mnubo_variables").mnubo6.owner,\n "age": 35,\n "gender": "male",\n 'x_timestamp': new Date().toISOString()\n }\n ]\n};\n","outputs":1,"noerr":0,"x":120,"y":800,"wires":[["991d1b38.441fb8"]]},{"id":"12e4911c.0c0f4f","type":"switch","z":"892d6ac6.a94368","name":"Fail/OK","property":"errors","propertyType":"msg","rules":[{"t":"nnull"},{"t":"null"}],"checkall":"true","repair":false,"outputs":2,"x":540,"y":800,"wires":[["afcd2cbd.08173","7b2c4be9.59fe94"],["a15ccdf1.3e237"]]},{"id":"afcd2cbd.08173","type":"debug","z":"892d6ac6.a94368","name":"Error","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"errors","x":670,"y":778,"wires":[]},{"id":"a15ccdf1.3e237","type":"debug","z":"892d6ac6.a94368","name":"OK","active":true,"console":"false","complete":"payload","x":670,"y":818,"wires":[]},{"id":"991d1b38.441fb8","type":"mnubo owners","z":"892d6ac6.a94368","name":"Update","mnuboconfig":"7e770dbf.06e484","functionselection":"update","inputtext":"","x":380,"y":800,"wires":[["12e4911c.0c0f4f"]]},{"id":"1aa87fcd.b830d","type":"function","z":"892d6ac6.a94368","name":"Bulk Creation (All Fail)","func":"return {"payload": [global.get("mnubo_variables").mnubo1.owner, global.get("mnubo_variables").mnubo2.owner, global.get("mnubo_variables").mnubo6.owner]};","outputs":1,"noerr":0,"x":155,"y":382.2222137451172,"wires":[["59d248b2.71a0d8"]]},{"id":"59d248b2.71a0d8","type":"mnubo owners","z":"892d6ac6.a94368","name":"Exists","mnuboconfig":"7e770dbf.06e484","functionselection":"exists","inputtext":"owner-1","x":373.5,"y":383.8888912200928,"wires":[["9b8504b0.ca6b68"]]},{"id":"9b8504b0.ca6b68","type":"switch","z":"892d6ac6.a94368","name":"Fail/OK","property":"errors","propertyType":"msg","rules":[{"t":"nnull"},{"t":"null"}],"checkall":"true","repair":false,"outputs":2,"x":503.5,"y":383.8888912200928,"wires":[["394f44d1.f5c1dc"],["f0f05a73.603b28"]]},{"id":"10d9aca2.4499d3","type":"switch","z":"892d6ac6.a94368","name":"Fail/OK","property":"errors","propertyType":"msg","rules":[{"t":"nnull"},{"t":"null"}],"checkall":"true","repair":false,"outputs":2,"x":954,"y":385.2222137451172,"wires":[["5f83962a.7fbce8","6a79db3f.dfd764"],["9bf52c70.919b5"]]},{"id":"5f83962a.7fbce8","type":"debug","z":"892d6ac6.a94368","name":"Error","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"errors","x":1084,"y":363.2222137451172,"wires":[]},{"id":"9bf52c70.919b5","type":"debug","z":"892d6ac6.a94368","name":"OK","active":true,"console":"false","complete":"payload","x":1085,"y":418.2222137451172,"wires":[]},{"id":"f0f05a73.603b28","type":"function","z":"892d6ac6.a94368","name":"Create Body","func":"var owner_to_create = [];\n\nmsg.payload.forEach((el, index) => {\n owner_to_create.push(\n {\n 'username': Object.keys(el)[0],\n 'x_registration_date': new Date().toISOString(),\n "gender": "Male"\n });\n})\n\nreturn {"payload": owner_to_create}","outputs":1,"noerr":0,"x":656,"y":384.2222137451172,"wires":[["4358ede4.7811d4"]]},{"id":"4358ede4.7811d4","type":"mnubo owners","z":"892d6ac6.a94368","name":"Create","mnuboconfig":"7e770dbf.06e484","functionselection":"create","inputtext":"[\n {"username": "mnubo5.owner",\n "x_password": "MnuboDummyPassword"\n },\n {"username": "mnubo6.owner",\n "x_password": "MnuboDummyPassword",\n "gender": "male"\n }]","x":823,"y":384.2222137451172,"wires":[["10d9aca2.4499d3"]]},{"id":"394f44d1.f5c1dc","type":"debug","z":"892d6ac6.a94368","name":"Error","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"errors","x":608,"y":345.2222137451172,"wires":[]},{"id":"7b2c4be9.59fe94","type":"link out","z":"892d6ac6.a94368","name":"Owner - Bulk Update (all Fail)","links":["cabfc12e.48066"],"x":790.55553150177,"y":792.2222261428833,"wires":[]},{"id":"70de919e.664cf","type":"function","z":"7ac1bef6.f9eb","name":"exists?","func":"if (msg.payload[global.get("mnubo_variables").mnubo1.object]) {\n return [msg, null]\n}\nelse {\n return [null, {\n "payload": {\n "x_device_id": global.get("mnubo_variables").mnubo1.object,\n 'x_object_type': "car",\n 'x_registration_date': new Date().toISOString(),\n 'x_registration_latitude': -34.586547,\n \t'x_registration_longitude': -58.398396,\n \n }\n }]\n}","outputs":2,"noerr":0,"x":667,"y":84.11110925674438,"wires":[["286ac26a.cbb29e"],["fe28dc3b.af5f7"]],"outputLabels":["Alredy exists","Does not exists"]},{"id":"10a84f51.b04171","type":"switch","z":"7ac1bef6.f9eb","name":"Fail/OK","property":"errors","propertyType":"msg","rules":[{"t":"nnull"},{"t":"null"}],"checkall":"true","repair":false,"outputs":2,"x":527,"y":83.11110925674438,"wires":[["5177e49.0142b1c"],["70de919e.664cf"]]},{"id":"5177e49.0142b1c","type":"debug

Node Info

Version: 2.0.0
Updated 5 years, 7 months ago
License: MIT
Rating: not yet rated

Actions

Rate:

Downloads

0 in the last week

Nodes

  • mnubo config
  • mnubo auth
  • mnubo analytics
  • mnubo owners
  • mnubo objects
  • mnubo events
  • mnubo model

Keywords

  • node-red
  • mnubo
  • api
  • sdk
  • javascript
  • typescript
  • iot
  • smartobject