Machine classification

Overview
Set Machine classification request
Set Machine classification response
Error Message
Sample code


Overview

This method allows the developer to classify machine states, as ongoing or predefined times.

The desired classification is selected by the key from the list obtained in Get Machine classifications Values

In order to set machine classification, the developer must fill in the reason id, machine id, and time period for the predefined case. In case the end time is empty, the application will classify the machine state up to a maximum of the end of the current shift, or until new calls with end time are entered into the system.


Set machine classifications request

Pre steps

  1. Get Token
  2. Get Machines Info
  3. Get Machine Classifications Id

API Method

Method Name
setMachineClassification
URLhttps://developers.3dsignals.io/api/v1/machineClassification
HTTP MethodPOST
Accepted content typesapplication/json
JSON sample{
"machineId": "string",
"startTime": 1614273208,
"endTime": 1614273314,
"reason": "string"
}

Data Structure

Field nameData TypeField description
machineIdstringThe request machine ID
startTimeepoch timestamp in secondsThe start time for selected reason
endTimeepoch timestamp in secondsThe end time for selected reason
reasonIdstringThe request reason ID

Set Machine classification response  

Response code 200 for success.


Error Message

Error codeReason
403- ForbiddenUnauthorized scope request
422- Unprocessable Entity Machine/reason ID not defined
422- Unprocessable EntityStart time > End Time
422- Unprocessable EntityFuture start time
422- Unprocessable EntityRequest without start and/or end times

Sample code

Postman

CURL

curl --location --request POST 'https://developers.3dsignals.io/api/v1/machineClassification' \
--header 'Authorization: Bearer YOUR_TOKEN \
--header 'Content-Type: application/json' \
--data-raw '{
  "machineId": "string",
  "startTime": 1614273208,
  "endTime": 1614273314,
  "reason": "string"
}'

Python

import requests
import json
url = "https://developers.3dsignals.io/api/v1/machineClassification"
payload = json.dumps({
  "machineId": "string",
  "startTime": 1614273208,
  "endTime": 1614273314,
  "reason": "string"
})
headers = {
  'Authorization': 'Bearer Your_Token',
  'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)