Select the tab
ESET Connect – Table of Contents

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.

Key inputs for an API call:

HTTP method

Endpoint URL

Authorization

Ensure you use the correct domain when sending an API call from the command line. You can locate the list of domains with the corresponding region in the Network Prerequisites topic. For details on the HTTP method, request path, request parameters, response and response codes, refer to the API Reference pages.

Alternatively, you can check the Swagger documentation specific to your geographical region. When you select the required definition, you can see the corresponding domain under Servers.

Authorization requires the access token. To receive the access token, you must authenticate the API user.

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.

Command parameters details:

curl

The tool used to send API calls.

-X

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

POST

The HTTP method

https://DOMAIN_AUTH/oauth/token

The endpoint URL for Authentication; use the domain according to the location of your ESET PROTECT/ESET Inspect Server (EU, DE, US, JPN, CA).

-H

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

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

A required header and its value

-d

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

grant_type

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

username

The username of the dedicated API user

password

The password of the dedicated API user

refresh_token

An 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.Type the following input with the corresponding domain in the command line. Include the access token in the Authorization header.

Command parameters details:

curl

The tool used to send API calls

-X

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

GET

The HTTP method

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

The endpoint URL for Automation with the pageSize parameter; use the domain according to the location of your ESET PROTECT/ESET Inspect Server (EU, DE, 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

A 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.