Machine activity log

Overview
Get machine activity Log request
Get machine activity log response
Error Message
Sample code


Overview

This method returns the machine’s activity data for a specific machine in a specific time frame. The request has the following limitations per each request: Maximum period is 30 days.

limitations

The request has the following limitations per each request: Maximum period allowed (from start to end time) is 30 days.


Get machine activity Log request

Pre steps:

  1. Get Token
  2. Get Machines Info

API Method

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

Data Structure

Field nameData TypeField description
startTimeIntegerstart-time in epoch timestamp in seconds
endTimeIntegerend-time in epoch timestamp in seconds
machineIdstringrequest machine ID

Get Machine activity Log response

Response code 200 will contain a JSON file with a list of the machine’s activities

Field nameData TypeField description
activityepoch timestamp in secondsThe state start time

Where each object contains the following fields:

Field nameData TypeField description
startTimeIntegerepoch timestamp in seconds
endTimeIntegerepoch timestamp in seconds
machineStatestring“OPERATING”/ ”IDLE”/ “OFF”

Example of response:


Error Message

Error codeReason
403- ForbiddenUnauthorized scope request
422- Unprocessable EntityMissing Machine ID
422- Unprocessable EntityStart time > End Time
422- Unprocessable EntityRequest period > Maximum allowed period
204- No ContentNo Data available

Sample Code

Postman

CURL

curl --location --request POST 'https://developers.3dsignals.io/api/v1/machineActivity' \
--header 'Authorization: Bearer YOUR TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
    "startTime":1234,
    "endTime":1234,
    "machineId":"MACHINE_ID"
}'

Python

import requests
import json

url = "https://developers.3dsignals.io/api/v1/machineActivity"
payload = json.dumps({
  "startTime": 1234,
  "endTime": 1234,
  "machineId": "MACHINE ID"
})
headers = {
  'Authorization': 'Bearer TOUR_TOKEN',
  'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)