Authentication request

Prev Next

To log in to your appliance from a remote server using the Web Services API, send the following HTTP POST request URL and headers:

POST https://<address>/wsapis/common/[v1.2.0|v2.0.0]/auth/login

Required headers:

Authorization: Basic [Base64(Username:Password)]
X-FeClient-Token: [Client-Token]

Parameters

  • address—The IP address of the appliance running the Web Services API.

  • Base64 (Username: Password)—The base64-encrypted user name and password supplied by the appliance's administrator.

  • Client-Token—(Optional) This client token is provided by Trellix. For more information about the client token, contact your sales representative.

Example

The following is an example of a valid authentication request:

POST https://xxx.xxx.xxx.xxx:443/wsapis/common/v2.0.0/auth/login

Request headers:

Authorization: Basic dGVzdDp0ZXN0
X-FeClient-Token: BigDataInc

Authentication response

After it receives the authentication request, your appliance authenticates the user account and responds with either an authentication confirmation code, along with an API-Token used to maintain the authenticated session or an authentication invalid code.

HTTP/1.1 [Response Code] [Response Message]
Date: [Date]
X-FeApi-Token: [API-Token]
X-FeClient-Token: [Client-Token]
Response fields
  • Response Code—A standard HTML response code.

    • 200—Authentication Success

    • 401—Authentication Refused

    • 503—Web Services API server disabled

  • Response Message—A standard HTML response message.

    • OK—Authentication Success

    • Unauthorized—Authentication Refused

    • Not available—Web Services API server disabled

  • Date—Standard HTML date format

  • API-Token—This token authenticates the session. By default, the session times out after 15 minutes of inactivity.

  • Client-Token—(Optional) This client token is provided by Trellix. For more information about the client token, contact your sales representative.

Example

The following is an example of a valid response received from an appliance.

HTTP/1.1 [Response Code] [Response Message]
Date: Fri, 20 Oct 2017 08:00:00
X-FeApi-Token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
X-FeClient-Token: BigDataInc

cURL code sample: Authentication

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

curl -qgsSkH --no-progress-bar --header "Authorization: Basic dGVzdDp0ZXN0" -D /cygdrive/c/tmp/auth.txt -F form=foo https://xxx.xxx.xxx.xxx:443/wsapis/common/v2.0.0/auth/login

  • -q—This option specifies that the curlrc configuration file will not be 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.

  • --header "Authorization: Basic dGVzdDp0ZXN0"—This custom header provides a base64-encoded user name and password to be used to authenticate with your appliance. In this example, dGVzdDp0ZXN0 resolves to the user name:password key pair: test:test.

  • -D /cygdrive/c/tmp/auth.txt—This file name and path include the response from your appliance. The contents of this file appear as follows:

    HTTP/1.1 100 Continue HTTP/1.1 200 OK Date: Wed, 15 Jan 2014 03:03:15 GMT X-FeApi-Token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Content-Length: 0 Content-Type: text/plain; charset=UTF-8

  • -F form=foo— The -F option and the subsequent empty form force the cURL tool to use the HTTP POST request.

  • https://xxx.xxx.xxx.xxx:443/wsapis/common/v2.0.0/auth/login—The authentication request URL. Replace the IP address xxx.xxx.xxx.xxx with the actual IP address of your appliance.

Results

The auth.txt file is populated with the response data.