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()
Destroy the current session
This destroys the current session, effectively terminating the access to the service.
<?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;
}
?>
This endpoint does not need any parameter.
void (empty response body)
- 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]
\Swagger\Client\Model\SessionInfo sessionGet()
Get session information
This returns information about the current session.
<?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;
}
?>
This endpoint does not need any parameter.
\Swagger\Client\Model\SessionInfo
- 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]
\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.
<?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;
}
?>
Name | Type | Description | Notes |
---|---|---|---|
login | string | The username of the user trying to connect. | |
password | string | The password of the user |
\Swagger\Client\Model\SessionInfo
No authorization required
- 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]