# JReportServer.UserSessionApi

All URIs are relative to *http://localhost:8888/jrserver/api/v1*

Method | HTTP request | Description
------------- | ------------- | -------------
[**getCurrentUserSession**](UserSessionApi.md#getCurrentUserSession) | **GET** /session | Get the current user session.
[**login**](UserSessionApi.md#login) | **POST** /session | Create new user session (login).
[**logout**](UserSessionApi.md#logout) | **DELETE** /session | Delete the current user session (logout).
[**setSessionTimeout**](UserSessionApi.md#setSessionTimeout) | **PUT** /session/timeout | Set session timeout in seconds. A negative time indicates the session should never timeout.


<a name="getCurrentUserSession"></a>
# **getCurrentUserSession**
> UserSession getCurrentUserSession()

Get the current user session.



### Example
```javascript
var JReportServer = require('j_report_server');
var defaultClient = JReportServer.ApiClient.instance;

// Configure HTTP basic authorization: user_auth
var user_auth = defaultClient.authentications['user_auth'];
user_auth.username = 'YOUR USERNAME';
user_auth.password = 'YOUR PASSWORD';

var apiInstance = new JReportServer.UserSessionApi();

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getCurrentUserSession(callback);
```

### Parameters
This endpoint does not need any parameter.

### Return type

[**UserSession**](UserSession.md)

### Authorization

[user_auth](../README.md#user_auth)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: text/plain, application/json

<a name="login"></a>
# **login**
> UserSession login(opts)

Create new user session (login).



### Example
```javascript
var JReportServer = require('j_report_server');
var defaultClient = JReportServer.ApiClient.instance;

// Configure HTTP basic authorization: user_auth
var user_auth = defaultClient.authentications['user_auth'];
user_auth.username = 'YOUR USERNAME';
user_auth.password = 'YOUR PASSWORD';

var apiInstance = new JReportServer.UserSessionApi();

var opts = { 
  'username': "username_example", // String | 
  'password': "password_example", // String | 
  'organization': "organization_example", // String | 
  'externalAuthenticationParameter': "externalAuthenticationParameter_example", // String | Transfers a string by formData for external authentication.
  'externalAuthenticationHeader': "externalAuthenticationHeader_example" // String | Transfers a string by header for external authentication.
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.login(opts, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **username** | **String**|  | [optional] 
 **password** | **String**|  | [optional] 
 **organization** | **String**|  | [optional] 
 **externalAuthenticationParameter** | **String**| Transfers a string by formData for external authentication. | [optional] 
 **externalAuthenticationHeader** | **String**| Transfers a string by header for external authentication. | [optional] 

### Return type

[**UserSession**](UserSession.md)

### Authorization

[user_auth](../README.md#user_auth)

### HTTP request headers

 - **Content-Type**: application/x-www-form-urlencoded
 - **Accept**: text/plain, application/json

<a name="logout"></a>
# **logout**
> UserSession logout()

Delete the current user session (logout).



### Example
```javascript
var JReportServer = require('j_report_server');
var defaultClient = JReportServer.ApiClient.instance;

// Configure HTTP basic authorization: user_auth
var user_auth = defaultClient.authentications['user_auth'];
user_auth.username = 'YOUR USERNAME';
user_auth.password = 'YOUR PASSWORD';

var apiInstance = new JReportServer.UserSessionApi();

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.logout(callback);
```

### Parameters
This endpoint does not need any parameter.

### Return type

[**UserSession**](UserSession.md)

### Authorization

[user_auth](../README.md#user_auth)

### HTTP request headers

 - **Content-Type**: application/json
 - **Accept**: text/plain, application/json

<a name="setSessionTimeout"></a>
# **setSessionTimeout**
> setSessionTimeout(opts)

Set session timeout in seconds. A negative time indicates the session should never timeout.



### Example
```javascript
var JReportServer = require('j_report_server');
var defaultClient = JReportServer.ApiClient.instance;

// Configure HTTP basic authorization: user_auth
var user_auth = defaultClient.authentications['user_auth'];
user_auth.username = 'YOUR USERNAME';
user_auth.password = 'YOUR PASSWORD';

var apiInstance = new JReportServer.UserSessionApi();

var opts = { 
  'timeout': 56 // Number | 
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
apiInstance.setSessionTimeout(opts, callback);
```

### Parameters

Name | Type | Description  | Notes
------------- | ------------- | ------------- | -------------
 **timeout** | **Number**|  | [optional] 

### Return type

null (empty response body)

### Authorization

[user_auth](../README.md#user_auth)

### HTTP request headers

 - **Content-Type**: application/x-www-form-urlencoded
 - **Accept**: text/plain, application/json

