All URIs are relative to http://localhost:3000
Method | HTTP request | Description |
---|---|---|
session_delete | DELETE /session | Destroy the current session |
session_get | GET /session | Get session information |
session_post | POST /session | Create a new session |
session_delete
Destroy the current session
This destroys the current session, effectively terminating the access to the service.
# load the gem
require 'cbrain_client'
# setup authorization
CbrainClient.configure do |config|
# Configure API key authorization: BrainPortalSession
config.api_key['cbrain_api_token'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['cbrain_api_token'] = 'Bearer'
end
api_instance = CbrainClient::SessionsApi.new
begin
#Destroy the current session
api_instance.session_delete
rescue CbrainClient::ApiError => e
puts "Exception when calling SessionsApi->session_delete: #{e}"
end
This endpoint does not need any parameter.
nil (empty response body)
- Content-Type: application/json, application/x-www-form-urlencoded, multipart/form-data
- Accept: application/json, application/xml
SessionInfo session_get
Get session information
This returns information about the current session.
# load the gem
require 'cbrain_client'
# setup authorization
CbrainClient.configure do |config|
# Configure API key authorization: BrainPortalSession
config.api_key['cbrain_api_token'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
#config.api_key_prefix['cbrain_api_token'] = 'Bearer'
end
api_instance = CbrainClient::SessionsApi.new
begin
#Get session information
result = api_instance.session_get
p result
rescue CbrainClient::ApiError => e
puts "Exception when calling SessionsApi->session_get: #{e}"
end
This endpoint does not need any parameter.
- Content-Type: application/json, application/x-www-form-urlencoded, multipart/form-data
- Accept: application/json, application/xml
SessionInfo session_post(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.
# load the gem
require 'cbrain_client'
api_instance = CbrainClient::SessionsApi.new
login = 'login_example' # String | The username of the user trying to connect.
password = 'password_example' # String | The password of the user
begin
#Create a new session
result = api_instance.session_post(login, password)
p result
rescue CbrainClient::ApiError => e
puts "Exception when calling SessionsApi->session_post: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
login | String | The username of the user trying to connect. | |
password | String | The password of the user |
No authorization required
- Content-Type: application/x-www-form-urlencoded
- Accept: application/json, application/xml