Skip to content

Latest commit

 

History

History
234 lines (158 loc) · 6.53 KB

TasksApi.md

File metadata and controls

234 lines (158 loc) · 6.53 KB

CbrainClient::TasksApi

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

Method HTTP request Description
tasks_get GET /tasks Get the list of Tasks.
tasks_id_get GET /tasks/{id} Get information on a Task.
tasks_operation_post POST /tasks/operation Control and apply operation to a set of tasks
tasks_post POST /tasks Create a new Task.

tasks_get

Array<CbrainTask> tasks_get(opts)

Get the list of Tasks.

This method returns the list of Tasks accessible to the current user.

Example

# 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::TasksApi.new

opts = { 
  page: 56, # Integer | Page number when paginating. See also the per_page parameter
  per_page: 56 # Integer | Size of each page when paginating. See also the page parameter
}

begin
  #Get the list of Tasks.
  result = api_instance.tasks_get(opts)
  p result
rescue CbrainClient::ApiError => e
  puts "Exception when calling TasksApi->tasks_get: #{e}"
end

Parameters

Name Type Description Notes
page Integer Page number when paginating. See also the per_page parameter [optional]
per_page Integer Size of each page when paginating. See also the page parameter [optional]

Return type

Array<CbrainTask>

Authorization

BrainPortalSession

HTTP request headers

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

tasks_id_get

CbrainTask tasks_id_get(id)

Get information on a Task.

This method returns information on a Task, including its status, Task restartability and information on where the results are kept.

Example

# 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::TasksApi.new

id = 56 # Integer | The ID number of the Task to delete.


begin
  #Get information on a Task.
  result = api_instance.tasks_id_get(id)
  p result
rescue CbrainClient::ApiError => e
  puts "Exception when calling TasksApi->tasks_id_get: #{e}"
end

Parameters

Name Type Description Notes
id Integer The ID number of the Task to delete.

Return type

CbrainTask

Authorization

BrainPortalSession

HTTP request headers

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

tasks_operation_post

Object tasks_operation_post(tasklist, operation)

Control and apply operation to a set of tasks

This method applies an operation to a set of tasks. The IDs of the tasks should be provided in the tasklist parameter, or one or many batches of tasks can be selected by providing their batch IDs in batchids. The operations supported are one of delete, archive, etc etc.

Example

# 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::TasksApi.new

tasklist = CbrainClient::BatchTaskModReq.new # BatchTaskModReq | The IDs or batch IDs of the tasks

operation = 'operation_example' # String | The operation to perform on the selected tasks


begin
  #Control and apply operation to a set of tasks
  result = api_instance.tasks_operation_post(tasklist, operation)
  p result
rescue CbrainClient::ApiError => e
  puts "Exception when calling TasksApi->tasks_operation_post: #{e}"
end

Parameters

Name Type Description Notes
tasklist BatchTaskModReq The IDs or batch IDs of the tasks
operation String The operation to perform on the selected tasks

Return type

Object

Authorization

BrainPortalSession

HTTP request headers

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

tasks_post

Array<CbrainTask> tasks_post(cbrain_task)

Create a new Task.

This method allows the creation of a new Task.

Example

# 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::TasksApi.new

cbrain_task = CbrainClient::CbrainTaskModReq.new # CbrainTaskModReq | The task to create.


begin
  #Create a new Task.
  result = api_instance.tasks_post(cbrain_task)
  p result
rescue CbrainClient::ApiError => e
  puts "Exception when calling TasksApi->tasks_post: #{e}"
end

Parameters

Name Type Description Notes
cbrain_task CbrainTaskModReq The task to create.

Return type

Array<CbrainTask>

Authorization

BrainPortalSession

HTTP request headers

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