cURL code sample: alert details

Prev Next

The following code sample can be copied and executed from any command-line interface that includes the cURL library. This sample builds on the authentication cURL code sample.

Note

In this sample, line breaks are added for readability. Remove these line breaks before you paste the code sample into your command-line tool.

curl -qgsSkH --no-progress-bar https://xxx.xxx.xxx.xxx:443/wsapis/v1.2.0/alerts/alert/4790 -X 'GET' --header "X-FeApi-Token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -H 'Accept: application/xml' -i

This cURL sample includes the following options:

  • -q—This option specifies that the curlrc config file is not read or used. Although this is an optional setting, Trellix recommends that you include this option.

  • -g—This option turns off the URL globbing parser. Although this is an optional setting, Trellix recommends that you include this option.

  • -s—This option turns off the progress meter and error message. Although this is an optional setting, Trellix recommends that you include this option.

  • -S—When used with the -s option, this option shows error messages if your cURL switch fails. Although this is an optional setting, Trellix recommends that you include this option.

  • -k—This option explicitly allows cURL to perform insecure SSL connections and transfers. This allows you to test your SSL connection without installing a CA certificate.

  • -H—This option allows you to specify a custom header with the --header switch.

  • --no-progress-bar—This option suppresses the cURL download progress bar, which can interfere with the request.

  • https://xxx.xxx.xxx.xxx:443/wsapis/v1.2.0/alerts/alert/4790—The alert acknowledgment request URL. Replace the IP address xxx.xxx.xxx.xxx with the IP address of your appliance. Replace 4790 with the infection ID or alert UUID of interest.

  • -X 'GET'—This option specifies using the GET method.

  • --header "X-FeApi-Token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"—This custom header provides the API-Token that was returned during the authentication request. In the authentication cURL code sample, this token was included in the auth.txt file. Replace the token value in the code sample with the token value received in the response to your authentication request.

    Note

    By default, the X-FeApi-Token times out after 15 minutes of inactivity.

  • -H 'Accept: application/xml'—This header specifies that the serverʼs response body is expected to be in XML format.

  • -i—This option returns the HTTP header in the response.

Results

This code sample returns the details of alert 4790. The response is in XML.