Versions Compared

Key

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

...

  • Join

  • Query

  • Insert

  • Update

  • UpdateById

  • Remove

  • RemoveById

  • Subscriptions

JOIN

The Join operation will be the first action to be made, because it allows you to connect to the defined IoTClient. If everything is OK, it will return the sessionKey, identifying the current session.

...

QUERY

The Query operation allows to get the data that were stored and associated to a given ontology. You must specify the ontology associated to the IoTClient/deviceTemplate in the ControlPanel.

Both Native and SQL queries are accepted. You can also perform SQL queries including SELECT/UPDATE/DELETE.

...

Native

...

SQL

...

...

Image Added


TO-DO (EXAMPLE UPDATE/DELETE)

INSERT

The Insert operation allows you to insert new data into the ontology, make sure the data has the structure defined in the ontology JSON Schema, otherwise it won't pass Schema validation. To ensure that the format is correct, the best choice is copying it directly from the Ontology Schema. It returns the inserted instance's id.

...

This operation will return the ID (or IDs in case data it's an array), which you can use later to perform operations 'by id'.

...

UPDATE

To update an existing instance, you can either update the whole instance or update selected fields.

In the first case you may want to use 'updateById'. It works similar to insert function.

...


For the second case, you may use 'update' function. This function only accepts Native queries. If you want to make SQL Updates, make use of the query function.

...

DELETE

If you want to delete a single instance, you may use 'removeById'.

...

on the other hand, if you want to delete all instances matching a particular filter, use 'remove' function. This function, as the update one, only accepts native queries.

...

SUBSCRIPTIONS

This API allows you to subscribe to an Ontology. When subscribed, any insert/update related to the subscribed ontology, will notify your client, resulting in an execution of your callback function passed to handle subscription notifications.

...

If you click in the example on 'subscribe', and then perform and insertion, if you go back to the subscribe tab, you will se that you received the instance you just inserted.

...

...

Full Example

Lastly, you can download those files mentioned in the beginning in the following link, also including an example html page to perform tests: Prueba ClientJS.zip