Skip to content

Latest commit

 

History

History
163 lines (114 loc) · 5.19 KB

SessionsApi.md

File metadata and controls

163 lines (114 loc) · 5.19 KB

Swagger\Client\SessionsApi

All URIs are relative to http://localhost:3000

Method HTTP request Description
sessionDelete DELETE /session Destroy the current session
sessionGet GET /session Get session information
sessionPost POST /session Create a new session

sessionDelete

sessionDelete()

Destroy the current session

This destroys the current session, effectively terminating the access to the service.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure API key authorization: BrainPortalSession
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('cbrain_api_token', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('cbrain_api_token', 'Bearer');

$apiInstance = new Swagger\Client\Api\SessionsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);

try {
    $apiInstance->sessionDelete();
} catch (Exception $e) {
    echo 'Exception when calling SessionsApi->sessionDelete: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

This endpoint does not need any parameter.

Return type

void (empty response body)

Authorization

BrainPortalSession

HTTP request headers

  • Content-Type: application/json, application/x-www-form-urlencoded, multipart/form-data
  • Accept: application/json, application/xml

[Back to top] [Back to API list] [Back to Model list] [Back to README]

sessionGet

\Swagger\Client\Model\SessionInfo sessionGet()

Get session information

This returns information about the current session.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure API key authorization: BrainPortalSession
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('cbrain_api_token', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('cbrain_api_token', 'Bearer');

$apiInstance = new Swagger\Client\Api\SessionsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);

try {
    $result = $apiInstance->sessionGet();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling SessionsApi->sessionGet: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

This endpoint does not need any parameter.

Return type

\Swagger\Client\Model\SessionInfo

Authorization

BrainPortalSession

HTTP request headers

  • Content-Type: application/json, application/x-www-form-urlencoded, multipart/form-data
  • Accept: application/json, application/xml

[Back to top] [Back to API list] [Back to Model list] [Back to README]

sessionPost

\Swagger\Client\Model\SessionInfo sessionPost($login, $password)

Create a new session

This is the main entry point to create a CBRAIN session. Note that if a user is currently logged in, a new session will not be created, and the current session will be re-used.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');

$apiInstance = new Swagger\Client\Api\SessionsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$login = "login_example"; // string | The username of the user trying to connect.
$password = "password_example"; // string | The password of the user

try {
    $result = $apiInstance->sessionPost($login, $password);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling SessionsApi->sessionPost: ', $e->getMessage(), PHP_EOL;
}
?>

Parameters

Name Type Description Notes
login string The username of the user trying to connect.
password string The password of the user

Return type

\Swagger\Client\Model\SessionInfo

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/x-www-form-urlencoded
  • Accept: application/json, application/xml

[Back to top] [Back to API list] [Back to Model list] [Back to README]