ESET Online Help

Search
Select the category
Select the topic

Send API calls using the command line

Prerequisites

To start sending API calls using the command line, ensure that curl is installed on your machine by running the curl --version command in the command line.

Main inputs for an API call:

HTTP method

Endpoint URL

Authorization

You can find the information about endpoint URLs and HTTP methods in Swagger documentation. Select the link according to your geographical region.

Authorization requires the access token.

Authentication

You can get your access token by following these steps:

1.Open the command line.

2.Type the following input with the corresponding domain, your username and password.

Input values details:

curl

The tool used to send API calls.

-X

This option represents a request. You can also use --request

POST

HTTP method

https://DOMAIN_AUTH/oauth/token

Endpoint URL for Authentication. Use the domain according to the location of your ESET PROTECT/ESET Inspect Server (EU, US, JPN, CA).

-H

This option represents a header. You can also use --header

Content-Type: application/x-www-form-urlencoded

Required header and its value

-d

This option represents data. You can also use --data

grant_type

Required field. Type password when requesting an access token or refresh_token when refreshing the existing token.

username

Username of the dedicated API user

password

Password of the dedicated API user

refresh_token

Optional field. Leave it empty or omit it completely when requesting an access token. Paste the refresh token string from the response when you need to refresh your token.

3.Press Enter.

4.Copy and save the access token from the response; you will need it for further API calls.

API call execution

To execute your first API call, follow the steps below:

1.Select an API call you want to use, for example, Automation GET /v1/device_tasks.

2.In the command line, type the following input with the corresponding domain. Paste the access token to the Authorization header.

Input values details:

curl

The tool used to send API calls.

-X

This option represents a request. You can also use --request

GET

HTTP method

https://DOMAIN_AUTOMATION/v1/device_tasks?pageSize=10

Endpoint URL for Automation with pageSize parameter. Use the domain according to the location of your ESET PROTECT/ESET Inspect Server (EU, US, JPN, CA).

For the pageSize parameter, we use 10 as an example. For more details, see Pagination.

-H

This option represents a header. You can also use --header

Authorization: Bearer

Required header and its value. Paste the access token you received in the previous call.

3.Press Enter.

4.The server returns a response with details about existing device tasks.