R Sessions
These resources manage the stateful R sessions living in the R server. Some operations may be limited depending on the user role.
List
- GET /r/sessions[?subject=(string: user_name)]
List the R sessions.
This entry point requires Authentication of a user. Users with
administrator
ormanager
role will be able to list other users sessions. Regular users can only list own R sessions.Example requests
Using cURL
curl --user administrator:password https://rock-demo.obiba.org/r/sessions
Using R (rockr)
library(rockr) conn <- rockr.connect(username="administrator", password="password", url = "https://rock-demo.obiba.org") rockr.sessions(conn)
Example response
HTTP/1.1 200 OK Content-Type: application/json [ { "id": "810cfda6-d0f5-472e-8796-0ce6905499d8", "subject": "user", "busy": false, "createdDate": "2021-02-24 09:11:08", "lastAccessDate": "2021-02-24 09:11:15" } ]
- Query Parameters
subject (string) – To filter sessions by their subject (owner of the session). Ignored when user does not have
administrator
ormanager
role.
- Response JSON Object
id (string) – R session unique ID.
subject (string) – User name owning the R session.
busy (boolean) – Whether an R operation is being executed.
createdDate (date) – Date of creation.
lastAccessDate (date) – Last time the R session was accessed, used to garbage collect sessions after some timeout.
- Request Headers
Authorization – As described in the Authentication section
Accept –
*/*
- Response Headers
Content-Type –
application/json
- Status Codes
200 OK – Server is alive and functional.
401 Unauthorized – User is not authenticated.
500 Internal Server Error – Sessions list could not be retrieved.
Remove
- DELETE /r/sessions
Terminate all the R sessions.
This entry point requires Authentication of a user with
administrator
ormanager
role.Example requests
Using cURL
curl --user administrator:password -X DELETE https://rock-demo.obiba.org/r/sessions
- Request Headers
Authorization – As described in the Authentication section
- Status Codes
204 No Content – Operation was completed.
401 Unauthorized – User is not authenticated.
403 Forbidden – User does not have the appropriate role for this operation.
500 Internal Server Error – An error occurred.
Create
- POST /r/sessions
Create a R session, which will be associated to the requesting user.
This entry point requires Authentication of a user with
administrator
oruser
role.Example requests
Using cURL
curl --user user:password -X POST https://rock-demo.obiba.org/r/sessions
Using R (rockr)
library(rockr) conn <- rockr.connect(username="user", password="password", url = "https://rock-demo.obiba.org") rockr.open(conn)
Example response
HTTP/1.1 201 Created Content-Type: application/json Location: http://rock-demo.obiba.org/r/session/810cfda6-d0f5-472e-8796-0ce6905499d8 { "id": "810cfda6-d0f5-472e-8796-0ce6905499d8", "subject": "user", "busy": false, "createdDate": "2021-02-24 09:11:08", "lastAccessDate": "2021-02-24 09:11:15" }
- Response JSON Object
id (string) – R session unique ID.
subject (string) – User name owning the R session.
busy (boolean) – Whether an R operation is being executed.
createdDate (date) – Date of creation.
lastAccessDate (date) – Last time the R session was accessed, used to garbage collect sessions after some timeout.
- Request Headers
Authorization – As described in the Authentication section
- Status Codes
204 No Content – Operation was completed.
401 Unauthorized – User is not authenticated.
403 Forbidden – User does not have the appropriate role for this operation.
500 Internal Server Error – An error occurred.