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.





webhookIdGuidrequired24a1b617-ff27-4b53-ab98-4d925bb3375e
producingUnitIDGuidrequiredProducing unit ID (same as measure point ID)
startTimeDateTimerequiredStart time
endTimeDateTimeoptionalEnd time
stopReasonIDGuidoptionalStop reason ID
commentstringoptionalText comment
stationIDGuidoptionalStation ID




ReturnsGuidOn successThe 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: '37c5b65d-aa69-4ce9-a6f5-fae89ccaf2a7', stopReasonID: '00000001-3f3e-4e19-8277-3e85180dcf95', endTime: '2020-03-16T19:37:53.771Z', stationID: '0e983d17-3918-4ebf-b2e3-77799423ee3f' }";

var client = WebClient();

client.Headers.Add("Content-Type", "application/json");
client.Headers.Add("Authorization: Bearer xxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx");
client.Encoding = System.Text.Encoding.UTF8

client.UploadString(uri, "POST", data);
C#

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.





webhookIdGuidrequired0b5645bb-d1b2-4b64-aa45-86eaf4ac38a7
inputIDGuidrequiredWeb service gateway input ID
timestampDateTimerequiredTime stamp when the cycle occurred
numberOfCyclesLongrequiredNumber of cycles to add
lastTimestampDateTimeoptionalIf null RSDateTime.Now is used




ReturnsLongOn successThe 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: '115bd70b-5a8e-4a5f-b4b3-44594696b1e6'}";

var client = WebClient();

client.Headers.Add("Content-Type", "application/json");
client.Headers.Add("Authorization: Bearer xxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx");
client.Encoding = System.Text.Encoding.UTF8

client.UploadString(uri, "POST", data);
C#

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



IOInterfaceInputStatusDownEvent  If the status changes from True to False
IOInterfaceInputStatusUpEvent If the status changes from False to True






webhookIdGuidrequired0b5645bb-d1b2-4b64-aa45-86eaf4ac38a7
inputIDGuidrequiredWeb service gateway input ID
currentStatusBoolrequiredThe current bool status of the input




ReturnsLongOn successNone

Call using c#

var uri = "http://xxxxxx.rsproduction.se:80/xxxxxx/api/webhook/"

var data = "{ webhookId: '50695fd4-1699-46b0-aae7-cc2da5c70a5f', currentStatus: 'True', inputID: '115bd70b-5a8e-4a5f-b4b3-44594696b1e6'}";

var client = WebClient();

client.Headers.Add("Content-Type", "application/json");
client.Headers.Add("Authorization: Bearer xxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx");
client.Encoding = System.Text.Encoding.UTF8

client.UploadString(uri, "POST", data);
C#