Triggering remote actions via their API
Overview
The API of Nexthink Act makes possible to trigger remote actions programmatically, enabling their integration with third-party products such as self-service portals or ticketing systems.
The API of remote actions is exposed by the Portal as a REST API. The present article documents Act API v2.
Applies to platforms | Windows | macOS |
Prerequisites
For a remote action to be triggered through the Act API, the following prerequisites apply:
The remote action can be manually triggered.
The remote action is triggered on behalf of a user whose profile includes Finder access with the option Allow API of remote actions ticked.
Calling the Act API
The Portal exposes the Act API as a REST API under the URL:
https://[portal.company.com]/api/remoteaction/v2/run
In the URL, substitute [portal.company.com]
for the external DNS name of your Portal.
To trigger a remote action, submit a POST request to the URL of the API (note that GET requests are not supported, returning a 404 error) with a JSON payload containing two parameters:
Name | Description |
---|---|
| (Optional) Identifier of the request for logging purposes. |
| Identifier of the remote action. |
| List of device identifiers to target. |
| (Optional) List of Engine identifiers to target. |
| (Optional) Request timeout in seconds. Overrides default timeout configured in the Portal (60 s). |
| (Optional) List of parameter inputs and values. Unknown parameter names are ignored. |
The call is dispatched either to all the Engines connected to the Portal or to the indicated Engines only and returns either when the Portal receives the answer from the targeted Engines or after the specified timeout is elapsed. A successful response from the Portal does not guarantee the execution of the remote action on the selected devices (see the list of codes for Engine responses below).
Obtaining the UIDs of remote actions, devices and Engines
To get the UID of a remote action:
Log in to the Finder as a user with the permission to edit remote actions.
Locate the desired remote action under the Remote actions section of the left-hand side menu.
Right-click the remote action name.
Select Export > Remote action Uid to clipboard.
In your request editor, press Ctrl+V to paste the UID into the JSON payload.
Find the UIDs of the devices through either:
The Finder: Display field UID of the device object.
NXQL: Retrieve the device_uid field of the device objects, for instance:
(select device_uid (from device))
To target specific Engines, get the UID of the database on each Engine via the List Engines API.
HTTP headers
Send your POST request to the API of remote actions with the following HTTP headers to specify JSON content and basic authentication:
Content-type: application/json
Authorization: Basic [base-64(user:password)]
Replace [base-64(user:password)]
with the credentials (in base-64 encoding) of a Nexthink user who has the right to access the API of remote actions.
Response
Successful response
When successful, a call to the Act API v2 returns a list of responses from each targeted Engine with HTTP code 200.
Name | Description |
---|---|
| The identifier of the targeted Engine |
|
|
| Possible additional message from the Engine |
Error response
When unsuccessful, a call to the Act API v2 returns an error response with HTTP code depending on the type of error.
Name | Description | |
---|---|---|
| Error code, one of: | HTTP code |
INVALID_REQUEST_JSON | 400 | |
INVALID_REQUEST_CONTENT | 400 | |
INTERNAL_ERROR | 500 | |
CONTENT_TYPE | 400 | |
ENCODING | 400 | |
NO_REMOTE_ACTION_UID | 400 | |
NO_DEVICES | 400 | |
TOO_MANY_DEVICES | 400 | |
INVALID_ACTION_UID | 400 | |
INVALID_DEVICE_UID | 400 | |
NO_PERMISSION | 403 | |
UNKNOWN_OR_DISABLED_REMOTE_ACTION | 400 | |
NO_MANUAL_EXECUTION | 400 | |
NO_ENGINES_TO_TARGET | 403 | |
| Description of the error code. |
Examples
Target all Engines
Example of a request that targets all Engines and its response in JSON format.
Target one Engine
Example of a request that targets one Engine and its response in JSON format.
Error response
Example of a request that returns an error because the remote action disabled manual execution.
RELATED TASK
RELATED REFERENCE
Last updated