Session: Request

Prev Next

To check if the current user is valid and if the session is still active, send the following request:

POST https://<IA_IP_address>:<port_number>/session

Required header:

Cookie: px=<token>

Options

  • IA_IP_address—The IP address of the NDR appliance running the NDR API.

  • port_number—The port number of the NDR appliance running the NDR API.

  • token—This token authenticates the session. By default, the session times out after 24 hours.

Example

POST https://xxx.xxx.xxx.xxx:443/session

Required header:

Cookie: px=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Session: Response

HTTP/1.1 [Response Code] [Response Message]				
Date: [Date]				
Content-Type: [Content Type]				
Username: [User Name]
Roles: [Roles]
Response fields
  • Response code—A standard HTTP response code.

    • 200—Request successful; the requested information is returned.

    • 4xx—Request unsuccessful.

  • Response message—A standard HTTP response message.

    • OK—Request successful; the requested information is returned.

    • Error message—Request unsuccessful.

  • Server—The server being used.

  • Date—Standard HTML date format.

  • Content type—The response format.

  • User name—The currently logged-in user.

  • Roles—All roles assigned to the currently logged-in user.

Example
HTTP/1.1 200 OK
Date: Wed, 16 Nov 2016 00:24:44 GMT
Content-Type: text/plain; charset=utf-8
{
  "Username":"npadmin",
  "Roles":[
    "npadmin",
    "wheel",
    "klish",
    "uiapi"
  ]
}

cURL code sample: Session

curl -k -i https://xxx.xxx.xxx.xxx:443/session -X POST 
--cookie "px=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

This cURL sample includes the following options:

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

  • -i—This option returns both the HTTP header and body of the response.

  • https://xxx.xxx.xxx.xxx:443/session—The authentication request URL. Replace xxx.xxx.xxx.xxx with the IP address of your NDR appliance.

  • -X POST—This option changes the HTTP method to POST.

  • --cookie "px=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"—This option specifies the authentication token for this session.

Results

This example returns the name of the currently logged-in user and all roles assigned to that user. The output is in JSON format.