Web IO-Interface
Included in the product Machine Data Interface
Use the Web IO in order to plug in your own devices to RS Production by just doing a web service call.
The webservice IO gateway consists of three web hooks
- RegisterStop
- Creates a stop with start and end time
- RegisterCycle
- Uses extended cycle signal in order to register production cycles
- RegisterStatus
- Uses extended cycle signal in order to register stop
How to use the web hooks
RegisterStop
The RegisterStop webhook can be called directly without any other dependencies, the function just creates a categorized stop without any logic if there already is an ongoing stop or not or anything else.
Field | Data type | Required | Description |
---|---|---|---|
webhookId | Guid | required | 24a1b617-ff27-4b53-ab98-4d925bb3375e |
producingUnitID | Guid | required | Producing unit ID (same as measure point ID) |
startTime | DateTime | required | Start time |
endTime | DateTime | optional | End time |
stopReasonID | Guid | optional | Stop reason ID |
comment | string | optional | Text comment |
stationID | Guid | optional | Station ID |
Returns | Guid | On success | The ID of the created categorized stop |
Call using c#
var uri = "http://xxxxxx.rsproduction.se:80/xxxxxx/api/webhook/";
var data = "{webhookId: '24a1b617-ff27-4b53-ab98-4d925bb3375e', comment: 'testing', startTime: '2020-03-16T19:36:53.769Z', producingUnitID: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', stopReasonID: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', endTime: '2020-03-16T19:37:53.771Z', stationID: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'}";
var client = WebClient();
client.Headers.Add("Content-Type", "application/json");
client.Headers.Add("Authorization: Bearer xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx");
client.Encoding = System.Text.Encoding.UTF8;
client.UploadString(uri, "POST", data);
RegisterCycle
Using the RegisterCycle webhook requires to set up a WebServiceIOGateway and a input for the gateway. The input needs to be configured together with an extended cycle signal action connected, which connects the input with the producing unit. The web hook raises the IOInterfaceInputUpFlankChangeEvent event and need to have a extended cycle signal action to work.
Field | Data type | Required | Description |
---|---|---|---|
webhookId | Guid | required | 0b5645bb-d1b2-4b64-aa45-86eaf4ac38a7 |
inputID | Guid | required | Web service gateway input ID |
timestamp | DateTime | required | Time stamp when the cycle occurred |
numberOfCycles | Long | required | Number of cycles to add |
lastTimestamp | DateTime | optional | If null RSDateTime.Now is used |
Returns | Long | On success | The number of cycles added |
Call using c#
var uri = "http://xxxxxx.rsproduction.se:80/xxxxxx/api/webhook/";
var data = "{webhookId: '0b5645bb-d1b2-4b64-aa45-86eaf4ac38a7', numberOfCycles: '10', timestamp: '2020-03-16T19:47:19.550Z', inputID: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'}";
var client = WebClient();
client.Headers.Add("Content-Type", "application/json");
client.Headers.Add("Authorization: Bearer xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx");
client.Encoding = System.Text.Encoding.UTF8;
client.UploadString(uri, "POST", data);
RegisterStatus
Using the RegisterStatus webhook requires to set up a WebServiceIOGateway and a input for the gateway. The input needs to be configured together with an extended cycle signal action connected, which connects the input with the producing unit. The web hook raises the following events
Event | Description |
---|---|
IOInterfaceInputStatusDownEvent | If the status changes from True to False |
IOInterfaceInputStatusUpEvent | If the status changes from False to True |
Field | Data type | Required | Description |
---|---|---|---|
webhookId | Guid | required | 50695fd4-1699-46b0-aae7-cc2da5c70a5f |
inputID | Guid | required | Web service gateway input ID |
currentStatus | Bool | required | The current bool status of the input |
Returns | No return |
Call using c#
var uri = "http://xxxxxx.rsproduction.se:80/xxxxxx/api/webhook/";
var data = "{webhookId: '50695fd4-1699-46b0-aae7-cc2da5c70a5f', currentStatus: 'True', inputID: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'}";
var client = WebClient();
client.Headers.Add("Content-Type", "application/json");
client.Headers.Add("Authorization: Bearer xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx");
client.Encoding = System.Text.Encoding.UTF8;
client.UploadString(uri, "POST", data);