Note: Advanced Article - assumes previous experience with REST APIs.
The Machine Attributes API allows you to send data to a specific attribute of a Machine via a RESTful API using the
/attributes/report endpoint. This enables many flexible options to integrate with Tulip from Node-RED, Python or other languages and services.
Setting up the Machine API
Note: If you have a Tulip Table API already set up, you may use that API Key and Secret
Navigate to your Settings > Bots
Click Create Bot in the upper right-hand corner of your screen
Name your bot, and select
attributes:writefor it's scope:
4. A modal with your API Key, Secret and Auth Header will appear. Please save this information as it can not be accessed again!
Congratulations - you've officially set up your Machine API!
Setting up a new Machine
Once you've set up your Machine API, a new Machine Data Source will appear on your instance. To view this datasource click Shop Floor > Machines, and navigate to Machine Data Sources:
You will have to create a new machine linked to this data source. To create a new machine navigate to Machine Library, and click Create Machine.
The following modal will appear:
Machine Name (Required): Name you machine
Machine Data Source (Required): Select Tulip API
Now that your machine is created, you'll need to add an attribute. Click on the + button in the top right of your screen:
For this example, we will be creating a Counter attribute of type Integer.
Once your attribute is created, click the + button again, and select the attribute:
Please click Save in the upper right corner.
Your Tulip instance is now set up with the Machine API, a Machine, and a Machine Attribute - now you can send data to a Tulip Machine from anywhere!
From here you can see the
machineID for the Counter attribute. This information can be copied by clicking the icon and will be used in the body of the http request.
To do this you will need to be familiar with REST APIs. Full documentation on how to use the
/attributes/report endpoint, including the query parameters and body format, can be found at your-company.tulip.co/apidocs or by following the link on the Bots page...
... and in the docs there is a section for Machine Monitoring
Check out this article if you want to take the API further and see how it can be used with Edge MC and Node-RED!