Retrieve command history for a managed device

Open in ChatGPT Open in ChatGPT to ask questions about this page
Open in Claude Open in Claude to ask questions about this page
Copy as MarkdownCopy this page as markdown to use with AI assistants
View as Markdown Open this page as markdown in a new tab

gets the command history for the device

Request URL

https://{server-hostname}:8383/api/v1/mdm/devices/{device_id}/commandhistory

Scope

MDMInventory.READCopied!

Header

Authorization: d92d4xxxxxxxxxxxxx15f52

Request Parameters

- Request Headers

AcceptstringMandatory
application/jsonapplication/jsonCopied!

- Path Parameters

device_idstringMandatory

Unique identifier of the device. Obtain from the Get Device List response

- Query Parameters

limitintegerOptional

Maximum number of records to return in a single response. Used together with offset for pagination

skip-tokenstringOptional

Pagination continuation token returned by a previous response. Pass it to fetch the next page of results

offsetintegerOptional

Zero-based index of the first record to return. Used together with limit for pagination

delta-tokenstringOptional

Token used for delta/incremental fetches. Pass the token returned from a previous response to retrieve only items modified since that point

daysintegerOptional

Number of days to look back from the current time when filtering results

start_timestringOptional

Start of the time range to filter by (epoch milliseconds, inclusive)

end_timestringOptional

End of the time range to filter by (epoch milliseconds, inclusive)

Sample Request

Curl
Java
Python
Deluge
PowerShell
Copied!
curl --request GET \
  --url 'https://appdomain/api/v1/mdm/devices/{device_id}/commandhistory?limit=SOME_INTEGER_VALUE&skip-token=SOME_STRING_VALUE&offset=SOME_INTEGER_VALUE&delta-token=SOME_STRING_VALUE&days=SOME_INTEGER_VALUE&start_time=SOME_STRING_VALUE&end_time=SOME_STRING_VALUE' \
  --header 'Accept: application/json' \
  --header 'Authorization:  d92d4xxxxxxxxxxxxx15f52'

Response Parameters

- HTTP code 200

Response Body - application/json
JSON Object
Hide Sub-Attributes
metadataJSON Object

Metadata about the result set

Show Sub-Attributes
total_record_countinteger

Total number of command history records

pagingJSON Object

Pagination links for navigating results

Show Sub-Attributes
nextstring

URL to the next page of results

previousstring

URL to the previous page of results

delta-tokenstring

Delta token for incremental queries

commandsJSON Array

Array of commands sent to the device

Show Sub-Attributes
JSON Object
Show Sub-Attributes
command_statusinteger

Overall command status: 0 - failed, 1 - Initiated, 2 - Success, 4 - In progress, -1 - not applicable

managed_statusinteger

Management status of the device

command_idlong

Unique command identifier

command_namestring

Name of the command (e.g., AssetScan)

added_timestring

Timestamp when the command was added

device_idstring

Device identifier

added_bylong

User ID who initiated the command

command_history_idlong

Unique command history record identifier

added_by_namestring

Username who initiated the command

command_lifeJSON Array

Array of status updates showing the lifecycle of the command

Show Sub-Attributes
JSON Object
Show Sub-Attributes
updated_timelong

Timestamp of the status update in milliseconds

status_descriptionstring

Description of the command status at this point

command_idlong

Command identifier

status_codeinteger

Status code: 0 - failed, 1 - Initiated, 2 - Success, 4 - In progress, -1 - not applicable

added_bylong

User ID who initiated the command

command_namestring

Name of the command

added_by_namestring

Username who initiated the command

remarksstring

Remarks for this status update

remarks_argsstring

Remark arguments (may be null)

remarksstring

Remarks about the command

Possible Response Codes

200HTTP code

Sample Response: HTTP 200

Paginated command history with lifecycle details

Copied!
  {
    "metadata": {
      "total_record_count": 4
    },
    "delta-token": "aHR0cDovL2xvY2FsaG9zdDo5MDIwL2FwaS92MS9tZG0vcHJvZmlsZXMvc2NlcHNldHRpbmdzOjoxNTQyOTU0OTEzOTI0",
    "paging": {
      "next": "https://appDomain/api/v1/mdm/devices/9007199254741001/commandhistory?skip-token=MjozOjE6MTU0Mjk1NDkxMzkxOA%3D%3D",
      "previous": "https://appDomain/api/v1/mdm/devices/9007199254741001/commandhistory?skip-token=Aexzsjk6nkL1psqmWdKigzGxOA%3D%3D"
    },
    "commands": [
      {
        "command_status": 2,
        "managed_status": 2,
        "command_id": 9007199254741304,
        "added_time": "1523370360750",
        "device_id": "9007199254741001",
        "added_by": 9007199254740996,
        "command_history_id": 9007199254740996,
        "command_life": [
          {
            "updated_time": 1560141503246,
            "status_description": "Command Success",
            "command_id": 9007199254741304,
            "status_code": 2,
            "added_by": 9007199254740996,
            "command_name": "AssetScan",
            "added_by_name": "admin",
            "remarks": "--"
          }
        ],
        "remarks_args": null,
        "command_name": "AssetScan",
        "added_by_name": "admin",
        "remarks": "--"
      }
    ]
  }
                
Show full

Duration: 1 minute | Threshold: 250 | Lock period: 5 minutes

Duration - Time window for the threshold.
Threshold - Number of API calls allowed within the specified duration.
Lock Period - Wait time before consecutive API requests.