Overview
Get machine activity Log request
Get machine activity log response
Error Message
Code sample


Overview

This method provides the user with the ability to get the machines activity data for a specific machines in a time frame. The request has the following limitations per each request: Maximum period 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
Data structTBD:: add subTable
JSON sample

Data Structure

Field nameData TypeField description
startTimeepoch timestamp in secondsThe beginning time
endTimeepoch timestamp in seconds The ending time 
machineIdstringThe request machine ID

Get Machine activity Log response

Response code 200 will contain a JSON file with a list of objects with the following fields.

Field nameData TypeField description
startTimeepoch timestamp in secondsThe beginning state time
endTimeepoch timestamp in secondsThe ending state time
machineStatestring“OPERATING”/ ”IDLE”/ “OFF”
durationInMinutesintegerDuration of the current state

Error Message

Error codeReason
403- ForbiddenUnauthorized scope request
422- Unprocessable EntityMissing Machine ID
422- Unprocessable EntityStart time > End Time
422- Unprocessable EntityRequest times > maximum times
204- No ContentNo Data

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)