# Sessions Controller Resource

The API allows you to login, logout, view user session and check api connection status.

### GET /session

Check api connection status by http status code. Api connection status is OK when http status code is equal 204 (No Content).

Response Body
media type | data type | description
--- | --- | ---
application/json | string (JSON) | no content

#### Example

##### Request

    GET /session
    Content-Type: application/json
    Accept: application/json

    ...

##### Response

    HTTP/1.1 200 OK
    Content-Type: application/json

    ...

### POST /session/login

Login user.

Request Body
media type | data type | description
--- | --- | ---
application/json | LoginRequest (JSON) | specify details to login as user

Response Body
media type | data type | description
--- | --- | ---
application/json | SessionInfoResponse (JSON) | details about user session

#### Example

##### Request

    POST /session/login
    Content-Type: application/json
    Accept: application/json

    { }

##### Response

    HTTP/1.1 201 Created
    Content-Type: application/json

    {
      "lastSuccessfulLogin" : 1451677502000,
      "lastFailedLogin" : 1451649601000,
      "uiTimeZone" : "UTC"
    }

### POST /session/login-with-token

Request Body
media type | data type
--- | ---
application/json | LoginWithTokenRequest (JSON)

Response Body
media type | data type | description
--- | --- | ---
application/json | SessionInfoResponse (JSON) |

#### Example

##### Request

    POST /session/login-with-token
    Content-Type: application/json
    Accept: application/json

    { }

##### Response

    HTTP/1.1 201 Created
    Content-Type: application/json

    {
      "lastSuccessfulLogin" : 1451677502000,
      "lastFailedLogin" : 1451649601000,
      "uiTimeZone" : "UTC"
    }

### POST /session/logout

Logout current user.

#### Example

##### Request

    POST /session/logout
    Content-Type: application/json

    ...

##### Response

    HTTP/1.1 201 Created

### GET /session/user

Get user session info.

Response Body
media type | data type | description
--- | --- | ---
application/json | SessionInfoResponse (JSON) | details about user session

#### Example

##### Request

    GET /session/user
    Content-Type: application/json
    Accept: application/json

    ...

##### Response

    HTTP/1.1 200 OK
    Content-Type: application/json

    {
      "lastSuccessfulLogin" : 1451677502000,
      "lastFailedLogin" : 1451649601000,
      "uiTimeZone" : "UTC"
    }

### POST /session/node/login

Login for node.

Request Body
media type | data type | description
--- | --- | ---
application/json | NodeLoginRequest (JSON) | specify details to login as node

Response Body
media type | data type | description
--- | --- | ---
application/json | SessionInfoResponse (JSON) | details about node session

#### Example

##### Request

    POST /session/node/login
    Content-Type: application/json
    Accept: application/json

    { }

##### Response

    HTTP/1.1 201 Created
    Content-Type: application/json

    {
      "lastSuccessfulLogin" : 1451677502000,
      "lastFailedLogin" : 1451649601000,
      "uiTimeZone" : "UTC"
    }

### GET /session/user/details

Get current user details.

Response Body
media type | data type | description
--- | --- | ---
application/json | AppUserDetails (JSON) | user details

#### Example

##### Request

    GET /session/user/details
    Content-Type: application/json
    Accept: application/json

    ...

##### Response

    HTTP/1.1 200 OK
    Content-Type: application/json

    {
      "guid" : "f8f73bf9-2445-4bce-a7dd-753be3b40a67",
      "lastSuccessfulLogin" : 1451649601000,
      "lastFailedLogin" : 1451677502000,
      "uiTimeZone" : "UTC"
    }