Skip to main content
Skip table of contents

Machine data Webservice API

RS Production’s web IO interface allows you to connect your devices to RS Production by making a web service call.

Files

RS HTTP JSON API.pdf

articles.json


Use the Web IO in order to plug in your own devices to RS Production by just doing a web service call.

The web service IO gateway consists of three webhooks

  • RegisterStop

    • Creates a stop with start and end time.

  • RegisterCycle

    • Use this function to register amounts (number of flanks) it can be used for both produced amounts and scraps.

  • RegisterStatus

    • Use this function to register a bool signal status change from True → False and vice versa.

How to use the webhooks

RegisterStop

The RegisterStop webhook can be called directly without any other dependencies. The function creates a categorized stop without any logic if there is an ongoing stop or not or anything else.

Call using c#
C#
var uri = "https://xxxxxx.rsproduction.se/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 setting up a WebServiceIOGateway and an input for the gateway.

The webhook raises the IOInterfaceInputUpFlankChangeEvent event. The input needs to be configured together with a signal action. The signal action can either be a Cycle signal action for registering the produced amount or a Scrap action to register scrap.

The signal action connects the input with the producing unit. 

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

Defaults to now

Returns

Long

On success

The number of cycles added

Call using c#
C#
var uri = "https://xxxxxx.rsproduction.se/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 setting up a WebServiceIOGateway and an input for the gateway. The input needs to be configured together with a signal action.

The signal action connects the input with the producing unit.

The webhook 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#
C#
var uri = "https://xxxxxx.rsproduction.se/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);

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.