This is an example on how to authenticate and initiate an instance in InRule Process Automation via the REST-API.
How to authenticate
Send a POST with the content-type: application/x-www-form-urlencoded to the following url: https://live.barium.se/api/v1.0/authenticate
To authenticate you will need the following:
username - [users email address]
password - [users password]
apikey - [API key for the specific space]
webTicket - true
Example
POST https://live.barium.se/api/v1.0/authenticate
Content-type: application/x-www-form-urlencoded
username=someuser@bariumlive.se&password=ABC123&apikey=f166af40-aa84-4cda-83f4-3f60c2298cc4&webTicket=true
The answer on this example call is:
It is the value in ticket that needs to be used in following calls, either by
- sending the value as a header with the name ticket (safer method), or
- sending the value as a query parameter in the URL of the call (less safer method)
How to start an instance
Send a POST with the content-type: application/x-www-form-urlencoded and the header: ticket=[ticket from the authentication] to the following url: https://live.barium.se/api/v1.0/apps/{APP-ID}?message={MESSAGE}
To start an instance you will need the following:
- A ticket from a /authenticate call
- A application ID for the application you will start an instance for
- A message name for the start event you wish to activate
- The field names for the fields that will receive information for the start
Read more about how to start an instance using the API here.
Example
POST
https://live.barium.se/api/v1.0/apps/49f32323-d79e-4a0f-bb4c-d5fc16bb4340
Headers
- ticket=f1327af40-aa84-4cda-83f4-3f60c2298cc4
- Content-type=application/x-www-form-urlencoded
Data
- message=START&instance.name=TEST123&XXXXXXXXXXXXXXXX
The answer to this example call is:
success: true means that the instance was created successfully and the InstanceId is this instance unique identifier.