In this guide, we are using onesait Platform CloudLab. This is a free installation of the platform offered in Cloud, where platform developers and potential users can probe the platform.
The main access is onesait Platform CloudLab: https://lab.onesaitplatform.com
Firstly, you must create a User. To do it, on the login page, select Sign Up and enter your id, password, name and e-mail address to access the platform. If you want to access the platform as a developer, you should select Developer role:
Once you have created the account, you can access with your user and password:
When you access the Control Panel with the developer role, you will see a page like this:
The main page shows you:
The first step is to model the data that we want to use. To do that, go to the menu option DEVELOPMENT -> My Ontologies
This option shows the available ontologies. Use the Create option, at the right upper corner, to create a new Ontology.
An Ontology represents your data's data model.
Complete the following information for your new Ontology:
When you finish adding properties, use UPDATE SCHEMA to add all the new properties to the Ontology. This shows the internal schema of the Ontology. The platform validates all messages of this type with this schema:
Finally, save the Ontology using the New Button at the end of the page:
After defining the ontology, you can define Digital Clients that work with that ontology.
An Digital Client is the representation of a physical device or system that is connected to the platform.
These devices will generate and/or consume data. To create one of these, go to the Digital Clients-> My Digital Clients menu option.
Use the Create button to define a new Digital Client.
Complete the following information for the new Digital Client:
Now you can save your Device with New button. In the list of Devices, you can view:
It is possible to define Device Simulators. This concept simulates a device sending information (Ontology instances) to the platform.
To do that, go to the Digital Clients-> My Digital Clients Simulations menu option and use the Create button, in the right upper corner, to define a new Simulator.
Complete the following information for the new Device Simulator:
Finally, save the simulator using the New button:
When you have created the simulator, it automatically starts generating data, as you can see in the list.
You can stop in the STOP button and then you´ll see:
To verify that the simulated device has inserted instances of the defined ontology, we can go to the menu TOOLS -> Query Tools and select our ontology:
When we pulse the Execute Query button, we can see some instances of my ontology:
You can publish operations over your Ontologies using creating REST APIs. In order to create an API, go to the menu back to the Control Panel web application and use the DEVELOPMENT -> My APIS menu option.
In the list, you can see APIs published as Public for other users.
Use the Create button. You must provide some information to create the API:
After these steps, you see Operations, then you must choose the operations that you want to expose in your API. There are several pre-created operations. Additionally, you can provide any other operation based on queries.
Then select Save Changes.
Finally, use the New button to save the API data:
When we have our finished API, then we can change its state. To do that, in the list of APIs, click the Development button:
We return to the option My APIs and we can see the new API:
In order to invoke the API we need a Token. You can access it in the section User Tokens on the upper side. You will see this screen:
Copy the value of the token (in this case 94355c7e26d7425babd98cfa27eeb082)
To test the API, you can use the integrated Swagger client. To do it, in the list of APIs, select your API and click the SWAGGER button:
This shows you a user interface like this:
You can click the section /getAll and then the Try It out
This allows the form to complete data,
In this case, you only have to fill the input X-OP-APIKey with the UserToken (94355c7e26d7425babd98cfa27eeb082).
Now click the Execute button.
The same test can be done with an external REST client, for instance Postman.
This is done by including, in the header of the HTTP requests, one parameter with key X-OP-APIKey and the token as value.