Retrieving and Installing Updates Using the API

Objective

To demonstrate how to use the Automox REST API to retrieve a list of available package updates for a specific endpoint and programmatically queue an update installation command.

Overview

The Automox API allows administrators to automate vulnerability management and patch deployment tasks outside of scheduled policies. By leveraging the /servers/{server_id}/packages and /servers/{server_id}/queues API endpoints, you can query device package inventories and trigger immediate software update commands.

For complete API documentation and endpoint references, visit the Automox Developer Portal.

Prerequisites & Parameters

Before executing API requests, gather your authentication key and target device parameters:

  • API Key: Located in the Automox console under Settings > Secrets & Keys. (See Managing Keys for details).

  • Organization ID (organization_id / o): Visible in the console URL query parameters (e.g., o=6).

  • Server/Device ID (server_id / s): Visible in the URL when viewing the target endpoint's Device Details page (e.g., s=68439 in [https://console.automox.com/device-detail?s=68439&o=6](https://console.automox.com/device-detail?s=68439&o=6)).

Step-by-Step API Workflow

 

1.Retrieve Device Package Inventory:

Issue a GET request to the /servers/{server_id}/packages endpoint to retrieve a full list of installed and pending software packages on the target device.

API Endpoint:

GET [https://console.automox.com/api/servers/](https://console.automox.com/api/servers/){server_id}/packages?o={organization_id}&api_key=YOUR_API_KEY

cURL Request Example:

Bash

 
curl -X GET \
  --header 'Accept: application/json' \
  'https://console.automox.com/api/servers/68439/packages?o=6&api_key=YOUR_API_KEY'

JSON Response Analysis:

To identify updates that are pending installation, filter the JSON array response for packages where "installed": false:

JSON

 
[
  {
    "id": 617664440,
    "server_id": 68439,
    "package_id": 214744671,
    "installed": false,
    "ignored": false,
    "deferred_until": null,
    "name": "org.mozilla.firefox",
    "display_name": "Firefox",
    "version": "56.0.1",
    "repo": "Installed",
    "package_type_name": "other",
    "severity": "other",
    "os_name": "OS X",
    "os_version": "10.12.6",
    "requires_reboot": false
  }
]

Note: Take note of the string inside the "name" key (e.g., "org.mozilla.firefox"), as it will be passed into the installation command in Step 2.

2.Issue Package Installation Command:

To queue an update command on the device, issue a POST request to the /servers/{server_id}/queues endpoint using the package name retrieved in Step 1.

API Endpoint:

POST [https://console.automox.com/api/servers/](https://console.automox.com/api/servers/){server_id}/queues?o={organization_id}&api_key=YOUR_API_KEY

Request Body Structure:

  • command_type_name (string, required): Set to "InstallUpdate" (or "Reboot" to trigger a device restart).
  • args (string, required): The target package name. For multiple packages, pass a space-delimited list of package names (e.g., "\"org.mozilla.firefox\" \"com.google.Chrome\"").

cURL Request Example:

Bash

 
curl -X POST \
  --header 'Content-Type: application/json' \
  --header 'Accept: application/json' \
  -d '{
    "command_type_name": "InstallUpdate",
    "args": "org.mozilla.firefox"
  }' \
  'https://console.automox.com/api/servers/68439/queues?o=6&api_key=YOUR_API_KEY'

Expected Response:

A successful API request returns an HTTP status code of 201 Created, indicating that the installation command has been queued for the Automox Agent to process on its next check-in.

 

Related Articles

Was this article helpful?
0 out of 0 found this helpful