cURL code sample: alert acknowledgment

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/2133 -X 'POST' --data-binary '{"annotation":"Discovered on December 1","alertType":"Malware Callback"}' --header "X-FeApi-Token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -H 'Accept: application/json' -H 'Content-Type: application/json' -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/2133—The alert acknowledgment request URL. Replace the IP address xxx.xxx.xxx.xxx with the IP address of your appliance. Replace 1234 with the infection ID or alert UUID of interest.

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

  • --data-binary '{"annotation":"Discovered on December 1","alertType":"Malware Callback"}'—This option specifies the comment added to the acknowledged alert and the type of alert.

  • --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/json'—This header specifies that the serverʼs response body is expected to be in JSON format.

  • -H 'Content-Type: application/json'—This header specifies that the request body is in JSON format.

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

Results

This code sample returns a response code and message to indicate if your request was successful.