Quick Start

POST a Device Event to the API

In this quick start we'll authenticate with the API and upload Device data to Open Industry.

API Endpoint

post
DeviceEvent/Create

https://openindustry.org/api/services/app/DeviceEvent/Create
Accepts DeviceEvent as JSON
Request
Response
Request
Headers
Authorization
required
string
Bearer ......
Content-Type:
required
string
application/json
Body Parameters
deviceId
required
number
Device Id
statusName
optional
string
Status Name
activityName
optional
string
Activity Name
cycleName
optional
string
Cycle Name
conditionName
optional
string
Condition Name
conditionNumber
optional
string
Condition Number
cycleRate
optional
integer
Cycle Rate Percentage
Entity1.....20
optional
object
20 Entity Values
Response
200: OK
‚Äč

Authorisation

Authorization Bearer token is always required

The API expects the Bearer token as an Authorization HTTP header.

To get a Bearer token use the following endpoint .

post
Authenticate

https://openindustry.org/api/TokenAuth/Authenticate
Returns an Authorization Bearer token.
Request
Response
Request
Headers
Content-Type
required
string
application/json
Body Parameters
userNameOrEmailAddress
required
string
Username
password
required
string
Password
Response
200: OK
Correct Username and Password
{
"accessToken": ".......",
"expireInSeconds": 86400,
"userId": 0,
"result": {}
}
500: Internal Server Error
Username and Password not correct
{
"success": false,
"error": {
"code": 0,
"message": "[Login failed]",
"details": "[Invalid user name or password]",
},
}

Device Event

Device Event endpoint always expects a Device Id every other parameter is optional.

{
"deviceId": 0,
"statusName": "string",
"activityName": "string",
"cycleName": "string",
"conditionName": "string",
"conditionNumber": 0,
"cycleRate": 0,
"entity1": {},
"entity2": {},
"entity3": {},
"entity4": {},
"entity5": {},
"entity6": {},
"entity7": {},
"entity8": {},
"entity9": {},
"entity10": {},
"entity11": {},
"entity12": {},
"entity13": {},
"entity14": {},
"entity15": {},
"entity16": {},
"entity17": {},
"entity18": {},
"entity19": {},
"entity20": {}
}

POST a Device Event

Using the Bearer token, Device Event model and end point we will now change the status of the device.

Lets create a Device Event as JSON for device with the Id of 1 and a status of STOPPED

{
"deviceId": 1,
"statusName": "STOPPED"
}

Using a HTTP client lets POST the model to the Device Event endpoint along with the Bearer token.

Example HTTP POST using Insomnia client