### Start Studio Session using cURL Source: https://docs.seqera.io/platform-api/start-data-studio Starts a Studio session via the Seqera Platform API using a cURL command. This example demonstrates the PUT request to the /studios/:sessionId/start endpoint, specifying the Content-Type, Accept headers, and an Authorization token. The request body is provided as a JSON string, detailing the studio's configuration and other parameters. ```bash curl --request PUT \ --url 'https://docs.seqera.io/studios/:sessionId/start?workspaceId=0' \ --header 'Accept: application/json' \ --header 'Authorization: Bearer ' \ --header 'Content-Type: application/json' \ --data '{ "configuration": { "gpu": 0, "cpu": 0, "memory": 0, "mountData": [ "string" ], "environment": {}, "condaEnvironment": "string", "lifespanHours": 0 }, "description": "string", "labelIds": [ 0 ], "spot": true }' ``` -------------------------------- ### Start Studio Session using Python Source: https://docs.seqera.io/platform-api/start-data-studio Initiates a Studio session by sending a PUT request to the Seqera Platform API. This example uses the http.client library in Python to construct and send the request, including the session ID, optional workspace ID, and a JSON payload for studio configuration. It handles the response by printing the decoded data. ```python import http.client import json conn = http.client.HTTPSConnection("docs.seqera.io") payload = json.dumps({ "configuration": { "gpu": 0, "cpu": 0, "memory": 0, "mountData": [ "string" ], "environment": {}, "condaEnvironment": "string", "lifespanHours": 0 }, "description": "string", "labelIds": [ 0 ], "spot": True }) headers = { 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Bearer ' } conn.request("PUT", "/studios/:sessionId/start", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### Launch Workflow API Request Example (Python) Source: https://docs.seqera.io/platform-api/describe-workflow-launch Example of how to launch a workflow using the Seqera Platform API with Python. This snippet demonstrates setting up an HTTP connection, defining headers including authorization, and making a GET request to the workflow launch endpoint. It requires a valid bearer token and workflow ID. ```python import http.client conn = http.client.HTTPSConnection("docs.seqera.io") payload = '' headers = { 'Accept': 'application/json', 'Authorization': 'Bearer ' } conn.request("GET", "/workflow/:workflowId/launch", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### Get Studio Session Details (Go) Source: https://docs.seqera.io/platform-api/describe-data-studio Retrieves studio session details using Go's `net/http` package. This example demonstrates making an authenticated GET request to the Seqera Platform API and handling the JSON response. ```go package main import ( "fmt" "io/ioutil" "net/http" "strings" ) func main() { url := "https://docs.seqera.io/studios/:sessionId?workspaceId=" client := &http.Client{} req, err := http.NewRequest("GET", url, nil) if err != nil { fmt.Println(err) return } req.Header.Add("Accept", "application/json") req.Header.Add("Authorization", "Bearer ") resp, err := client.Do(req) if err != nil { fmt.Println(err) return } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { fmt.Println(err) return } fmt.Println(string(body)) } ``` -------------------------------- ### List Team Workspaces API Request Examples Source: https://docs.seqera.io/platform-api/list-workspaces-by-team Examples for making a GET request to list workspaces for a team. It requires organization and team IDs, and supports optional pagination and search parameters. The response includes a list of workspaces or an error message. ```python import http.client conn = http.client.HTTPSConnection("docs.seqera.io") payload = '' headers = { 'Accept': 'application/json', 'Authorization': 'Bearer ' } conn.request("GET", "/orgs/:orgId/teams/:teamId/workspaces", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` ```curl curl --request GET \ --url 'https://docs.seqera.io/orgs/:orgId/teams/:teamId/workspaces?max=20&offset=0&search=my_workspace' \ --header 'Accept: application/json' \ --header 'Authorization: Bearer ' ``` ```java OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://docs.seqera.io/orgs/:orgId/teams/:teamId/workspaces?max=20&offset=0&search=my_workspace") .get() .addHeader("Accept", "application/json") .addHeader("Authorization", "Bearer ") .build(); Response response = client.newCall(request).execute(); ``` ```r library(httr) response <- VERB("GET", url = "https://docs.seqera.io/orgs/:orgId/teams/:teamId/workspaces", query = list(max = 20, offset = 0, search = "my_workspace"), httr::add_headers(`Accept` = "application/json", `Authorization` = "Bearer ")) content(response, "text") ``` ```javascript const options = { method: 'GET', headers: { 'Accept': 'application/json', 'Authorization': 'Bearer ' } }; fetch('https://docs.seqera.io/orgs/:orgId/teams/:teamId/workspaces?max=20&offset=0&search=my_workspace', options) .then(response => response.json()) .then(response => console.log(response)) .catch(err => console.error(err)); ``` ```go package main import ( "fmt" "net/http" "io/ioutil" ) func main() { client := &http.Client{} req, err := http.NewRequest("GET", "https://docs.seqera.io/orgs/:orgId/teams/:teamId/workspaces?max=20&offset=0&search=my_workspace", nil) if err != nil { fmt.Print(err) } req.Header.Add("Accept", "application/json") req.Header.Add("Authorization", "Bearer ") res, err := client.Do(req) if err != nil { fmt.Print(err) } defer res.Body.Close() bodyText, err := ioutil.ReadAll(res.Body) if err != nil { fmt.Print(err) } fmt.Print(string(bodyText)) } ``` ```powershell Invoke-RestMethod -Method Get -Uri 'https://docs.seqera.io/orgs/:orgId/teams/:teamId/workspaces?max=20&offset=0&search=my_workspace' -Headers @{Accept = 'application/json'; Authorization = 'Bearer '} ``` -------------------------------- ### Describe User Entity - Go Example Source: https://docs.seqera.io/platform-api/describe-user This Go code example demonstrates how to make an HTTP GET request to retrieve user details. It uses the standard `net/http` package to create a client, build the request with the correct URL and headers (including Authorization), send it, and then print the response body. This is suitable for Go applications needing API integration. ```go package main import ( "fmt" "io/ioutil" "net/http" ) func main() { userId := ":userId" token := "" url := fmt.Sprintf("https://docs.seqera.io/users/%s", userId) req, err := http.NewRequest("GET", url, nil) if err != nil { fmt.Printf("Error creating request: %s\n", err) return } req.Header.Set("Accept", "application/json") req.Header.Set("Authorization", "Bearer "+token) client := &http.Client{} res, err := client.Do(req) if err != nil { fmt.Printf("Error sending request: %s\n", err) return } defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil { fmt.Printf("Error reading response body: %s\n", err) return } fmt.Println(string(body)) } ``` -------------------------------- ### Python Example: Fetching Workspaces from Seqera API Source: https://docs.seqera.io/platform-api/list-data-studios This Python snippet demonstrates how to connect to the Seqera API using HTTP and retrieve workspace information. It requires an API token for authorization and sends a GET request to the '/studios' endpoint. ```python import http.client conn = http.client.HTTPSConnection("docs.seqera.io") payload = '' headers = { 'Accept': 'application/json', 'Authorization': 'Bearer ' } conn.request("GET", "/studios", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### List Actions (Go) Source: https://docs.seqera.io/platform-api/list-actions A Go program example for querying the Seqera Platform API to list actions. It uses the `net/http` package to construct and send an HTTP GET request to the `/actions` endpoint, including the necessary authorization and content type headers. ```go package main import ( "fmt" "io/ioutil" "net/http" ) func main() { client := &http.Client{} req, err := http.NewRequest("GET", "https://docs.seqera.io/actions", nil) if err != nil { fmt.Println(err) return } req.Header.Add("Accept", "application/json") req.Header.Add("Authorization", "Bearer ") res, err := client.Do(req) if err != nil { fmt.Println(err) return } defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil { fmt.Println(err) return } fmt.Println(string(body)) } ``` -------------------------------- ### Start Studio Source: https://docs.seqera.io/platform-api/info/studios-info Starts a Studio session. ```APIDOC ## POST /websites/seqera_io_platform-api/studios/{sessionId}/start ### Description Starts a Studio session. ### Method POST ### Endpoint /studios/{sessionId}/start ### Parameters #### Path Parameters - **sessionId** (string) - Required - Studio session numeric identifier #### Request Body - **configuration** (object) - Optional - Updated configuration for the studio session - **gpu** (integer) - GPU configuration - **cpu** (integer) - CPU configuration - **memory** (integer) - Memory configuration - **mountData** (array) - Data mount configuration - **environment** (object) - Environment variables - **condaEnvironment** (string) - Conda environment specification - **lifespanHours** (integer) - Lifespan in hours - **description** (string) - Optional - Updated description for the studio session - **labelIds** (array) - Optional - Array of label IDs to associate with the studio session - **spot** (boolean) - Optional - Whether to use a spot instance for the studio session ### Request Example ```json { "configuration": { "cpu": 2, "memory": 8 }, "labelIds": [3] } ``` ### Response #### Success Response (200) - ** message ** (string) - Success message indicating the studio has started #### Response Example ```json { "message": "Studio session sess-abc has been started." } ``` ``` -------------------------------- ### Get Workflow Logs - JavaScript Example Source: https://docs.seqera.io/platform-api/workflow-logs This JavaScript example uses the `fetch` API to get workflow logs. It constructs the request URL, sets the required headers for `Accept` and `Authorization`, and sends a GET request. The response is then processed to extract the JSON data. Ensure you replace `` with your authentication token and `:workflowId` with the target workflow's ID. ```javascript const workflowId = ":workflowId"; const token = ""; fetch(`https://docs.seqera.io/workflow/${workflowId}/log`, { method: 'GET', headers: { 'Accept': 'application/json', 'Authorization': `Bearer ${token}` } }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error)); ``` -------------------------------- ### Start Studio Source: https://docs.seqera.io/platform-api/start-data-studio Starts a specified Studio session with optional configuration overrides. This includes setting GPU, CPU, memory, mounting data, environment variables, conda environments, lifespan, descriptions, label IDs, and spot instance preferences. ```APIDOC ## PUT /studios/:sessionId/start ### Description Starts the given Studio session ID with optional configuration overrides. ### Method PUT ### Endpoint /studios/:sessionId/start ### Parameters #### Path Parameters - **sessionId** (string) - Required - Studio session numeric identifier #### Query Parameters - **workspaceId** (integer) - Optional - Workspace numeric identifier #### Request Body - **configuration** (object) - Optional - An optional overriding configuration for the studio to be started. - **gpu** (integer) - Optional - Minimum value: 0 - **cpu** (integer) - Optional - Minimum value: 0 - **memory** (integer) - Optional - Minimum value: 0 - **mountData** (string[]) - Optional - **environment** (object) - Optional - **property name*** (string) - Required - **condaEnvironment** (string) - Optional - Maximum length: 2048 characters - **lifespanHours** (integer) - Optional - Minimum value: 0 - **description** (string) - Optional - **labelIds** (integer[]) - Optional - **spot** (boolean) - Optional ### Request Example ```json { "configuration": { "gpu": 0, "cpu": 0, "memory": 0, "mountData": [ "string" ], "environment": {}, "condaEnvironment": "string", "lifespanHours": 0 }, "description": "string", "labelIds": [ 0 ], "spot": true } ``` ### Response #### Success Response (200) - **jobSubmitted** (boolean) - Indicates if the job was submitted successfully. - **sessionId** (string) - The ID of the studio session. - **statusInfo** (object) - Information about the status of the studio. - **status** (string) - The current status of the studio. Possible values: `starting`, `running`, `stopping`, `stopped`, `errored`, `building`, `buildFailed`. - **message** (string) - A descriptive message about the status. - **lastUpdate** (string) - The timestamp of the last status update. - **stopReason** (string) - The reason why the studio stopped. Possible values: `CREDITS_RUN_OUT`, `LIFESPAN_EXPIRED`, `SPOT_RECLAMATION`. #### Response Example ```json { "jobSubmitted": true, "sessionId": "string", "statusInfo": { "status": "starting", "message": "string", "lastUpdate": "2024-07-29T15:51:28.071Z", "stopReason": "CREDITS_RUN_OUT" } } ``` #### Error Response (403) - **message** (string) - Required - Error message indicating the operation is not allowed. #### Error Response (404) - **message** (string) - Required - Error message indicating the studio was not found or the API is disabled for the workspace. ### Authorization - **BearerAuth** (http) - Bearer token authentication ``` -------------------------------- ### Create Studio Source: https://docs.seqera.io/platform-api/info/studios-info Creates a new Studio session with specified configurations. ```APIDOC ## POST /websites/seqera_io_platform-api/studios ### Description Creates a new Studio session. ### Method POST ### Endpoint /studios ### Parameters #### Query Parameters - **workspaceId** (integer) - Optional - Workspace numeric identifier - **search** (string) - Optional - Optional search criteria, allowing free text search on name and templateUrl and keywords: `userId`, `computeEnvId` and `status`. - **max** (integer) - Optional - Pagination max results - **offset** (integer) - Optional - Pagination offset - **attributes** (array) - Optional - Optional attribute values to be included in the response (`labels`). Returns an empty value (`labels: null`) if omitted. - **autoStart** (boolean) - Optional - Optionally disable the Studio's automatic launch when it is created. - **orgId** (integer) - Optional - Organization numeric identifier - **status** (string) - Optional - Optional Studio status - **exclude** (string) - Optional - Optional Studio session ID to exclude in the request. - **name** (string) - Optional - Studio name to validate #### Request Body - **name** (string) - Required - Studio name - **description** (string) - Optional - Studio description - **dataStudioToolUrl** (string) - Required - URL of the data studio tool - **computeEnvId** (string) - Required - Compute environment ID - **initialCheckpointId** (integer) - Optional - Initial checkpoint ID - **configuration** (object) - Optional - Studio configuration - **gpu** (integer) - Optional - GPU configuration - **cpu** (integer) - Optional - CPU configuration - **memory** (integer) - Optional - Memory configuration - **mountData** (array) - Optional - Data mount configuration - **environment** (object) - Optional - Environment variables - **condaEnvironment** (string) - Optional - Conda environment specification - **lifespanHours** (integer) - Optional - Lifespan in hours - **isPrivate** (boolean) - Optional - Whether the studio is private - **labelIds** (array) - Optional - Array of label IDs - **spot** (boolean) - Optional - Whether the studio is a spot instance ### Request Example ```json { "name": "My New Studio", "description": "A studio for data science tasks", "dataStudioToolUrl": "rstudio/rstudio", "computeEnvId": "env-456", "configuration": { "cpu": 8, "memory": 32, "lifespanHours": 4 }, "isPrivate": true, "labelIds": [1, 2] } ``` ### Response #### Success Response (200) - ** studio ** (object) - The created studio object (structure similar to the list studios response) #### Response Example ```json { "studio": { "name": "My New Studio", "description": "A studio for data science tasks", "dataStudioToolUrl": "rstudio/rstudio", "computeEnvId": "env-456", "initialCheckpointId": null, "configuration": { "gpu": 0, "cpu": 8, "memory": 32, "mountData": [], "environment": {}, "condaEnvironment": "", "lifespanHours": 4 }, "isPrivate": true, "labelIds": [1, 2], "spot": false, "workspaceId": 1, "orgId": 1, "status": "Pending", "sessionId": "sess-def", "checkpointId": null, "created": "2023-10-27T12:00:00Z", "updated": "2023-10-27T12:00:00Z" } } ``` ``` -------------------------------- ### Python Example: Describe Organization Source: https://docs.seqera.io/platform-api/describe-organization Example of how to fetch organization details using Python's `http.client` library. It sends a GET request to the specified endpoint with necessary headers, including the Bearer token for authorization. ```python import http.client conn = http.client.HTTPSConnection("docs.seqera.io") payload = '' headers = { 'Accept': 'application/json', 'Authorization': 'Bearer ' } conn.request("GET", "/orgs/:orgId", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### Get Workflow Logs - cURL Example Source: https://docs.seqera.io/platform-api/workflow-logs This cURL command fetches workflow logs from the Seqera Platform API. It specifies the HTTP method (GET), the endpoint URL including a placeholder for `workflowId`, and includes necessary headers for accepting JSON and providing authentication via a Bearer token. Replace `` with your valid JWT. ```curl curl -X GET "https://docs.seqera.io/workflow/:workflowId/log" \ -H "Accept: application/json" \ -H "Authorization: Bearer " ``` -------------------------------- ### POST /studios Source: https://docs.seqera.io/platform-api/create-data-studio Creates a new Studio environment. By default, the studio starts automatically upon creation, but this behavior can be modified by setting the `autoStart` query parameter to `false`. ```APIDOC ## POST /studios ### Description Creates a new Studio environment, starting it by default. Default behavior can be changed using the query parameter `autoStart=false`. ### Method POST ### Endpoint /studios ### Parameters #### Query Parameters - **workspaceId** (int64) - Required - Workspace numeric identifier - **autoStart** (boolean) - Optional - Optionally disable the Studio's automatic launch when it is created. #### Request Body - **name** (string) - Required - Possible values: `non-empty` and `<= 80 characters` - **description** (string) - Optional - Possible values: `<= 2048 characters` - **dataStudioToolUrl** (string) - Required - Possible values: `non-empty` - **computeEnvId** (string) - Required - Possible values: `non-empty` - **initialCheckpointId** (integer) - Optional - **configuration** (object) - Optional - **gpu** (integer) - Optional - Possible values: `>= 0` - **cpu** (integer) - Optional - Possible values: `>= 0` - **memory** (integer) - Optional - Possible values: `>= 0` - **mountData** (string[]) - Optional - **environment** (object) - Optional, nullable - **property name*** (string) - Required - **condaEnvironment** (string) - Optional - Possible values: `<= 2048 characters` - **lifespanHours** (integer) - Optional - Possible values: `>= 0` - **isPrivate** (boolean) - Optional - **labelIds** (integer[]) - Optional, nullable - **spot** (boolean) - Optional, nullable ### Request Example ```json { "name": "MyStudio", "description": "A description for my studio", "dataStudioToolUrl": "https://example.com/tool", "computeEnvId": "compute-env-123", "initialCheckpointId": 12345, "configuration": { "gpu": 1, "cpu": 4, "memory": 16, "mountData": ["data-volume-1"], "environment": { "property name": "value", "condaEnvironment": "my-conda-env" }, "lifespanHours": 24, "isPrivate": false, "labelIds": [1, 2], "spot": true } } ``` ### Response #### Success Response (200) - **studioId** (string) - The unique identifier for the created Studio. - **status** (string) - The current status of the Studio. #### Response Example ```json { "studioId": "studio-abcde12345", "status": "STARTING" } ``` ``` -------------------------------- ### Get Workflow Logs - R Example Source: https://docs.seqera.io/platform-api/workflow-logs This R code uses the `httr` package to retrieve workflow logs. It constructs the API endpoint URL, sets the necessary headers including `Accept` and `Authorization`, and performs a GET request. The response content is then parsed. Replace `` with your Bearer token and `:workflowId` with the specific workflow ID. ```r library(httr) workflow_id <- ":workflowId" token <- "" response <- GET(paste0("https://docs.seqera.io/workflow/", workflow_id, "/log"), add_headers("Accept" = "application/json", "Authorization" = paste("Bearer", token))) content(response, "text") ``` -------------------------------- ### Create Compute Environment Source: https://docs.seqera.io/platform-api/describe-launch This endpoint allows for the creation of a new compute environment, defining its configuration, platform, and associated credentials. ```APIDOC ## POST /compute-environments ### Description Creates a new compute environment with specified configurations. ### Method POST ### Endpoint /compute-environments ### Parameters #### Request Body - **name** (string) - Required - Unique name for the compute environment. Must consist of 1-100 alphanumeric, dash, or underscore characters. - **description** (string) - Optional - Description of the compute environment. Maximum length: 2000 characters. - **platform** (string) - Required - Compute platform provider. Possible values: [`aws-batch`, `aws-cloud`, `google-lifesciences`, `google-batch`, `google-cloud`, `azure-batch`, `azure-cloud`, `k8s-platform`, `eks-platform`, `gke-platform`, `uge-platform`, `slurm-platform`, `lsf-platform`, `altair-platform`, `moab-platform`, `local-platform`, `seqeracompute-platform`] - **config** (object) - Required - Platform-specific configuration. Structure depends on the selected platform. - **discriminator** (string) - Platform-specific configuration. Possible values: [`moab-platform`, `aws-batch`, `google-cloud`, `azure-cloud`, `gke-platform`, `google-batch`, `aws-cloud`, `slurm-platform`, `k8s-platform`, `altair-platform`, `lsf-platform`, `azure-batch`, `seqeracompute-platform`, `eks-platform`, `google-lifesciences`, `uge-platform`] - **workDir** (string) - Nextflow work directory on the cluster's shared file system. Must be an absolute path and credentials must have read-write access. - **preRunScript** (string) - Script that executes prior to invoking Nextflow processes. - **postRunScript** (string) - Script that executes after all Nextflow processes have completed. - **nextflowConfig** (string) - Additional Nextflow configuration to apply. - **launchDir** (string) - Directory where Nextflow runs. Defaults to `workDir`. - **userName** (string) - Username for SSH connection to HPC head node. - **hostName** (string) - Hostname or IP address of HPC head node. - **port** (integer) - SSH port. Default: `22`. - **headQueue** (string) - Queue name on the cluster for launching Nextflow execution. - **computeQueue** (string) - Queue name on the cluster for submitting pipeline jobs. - **maxQueueSize** (integer) - Maximum number of jobs Nextflow can submit simultaneously. Default: `100`. - **headJobOptions** (string) - Additional submit options for the Nextflow head job. - **propagateHeadJobOptions** (boolean) - If true, `headJobOptions` are also applied to Nextflow-submitted compute jobs. - **environment** (array) - Array of environment variables. - **name** (string) - Required - Environment variable name. - **value** (string) - Required - Environment variable value. - **head** (boolean) - Apply this variable to the Nextflow head job. - **compute** (boolean) - Apply this variable to the Nextflow compute jobs. - **volumes** (array of strings) - EBS volumes to mount (format: `/host/path:/container/path`). - **region** (string) - Required - AWS region where resources will be created (e.g., `us-east-1`). - **computeQueue** (string) - AWS Batch compute queue for running jobs. - **dragenQueue** (string) - AWS Batch queue for DRAGEN workflows. - **dragenInstanceType** (string) - EC2 instance type for DRAGEN workflows (e.g., `f1.2xlarge`). - **computeJobRole** (string) - IAM role for AWS Batch compute jobs. ### Request Example ```json { "name": "my-aws-batch-env", "platform": "aws-batch", "config": { "discriminator": "aws-batch", "region": "us-east-1", "computeQueue": "MyComputeQueue", "workDir": "/mnt/shared/work", "environment": [ { "name": "MY_VAR", "value": "my_value", "compute": true } ] } } ``` ### Response #### Success Response (200) - **id** (string) - Compute environment identifier. - **name** (string) - Name of the compute environment. - **orgId** (integer) - Organization ID. - **workspaceId** (integer) - Workspace ID. #### Response Example ```json { "id": "ce-abcdef1234567890", "name": "my-aws-batch-env", "orgId": 1, "workspaceId": 1 } ``` ``` -------------------------------- ### Get Workflow Details - R httr Source: https://docs.seqera.io/platform-api/describe-workflow This snippet demonstrates how to call the Seqera Platform API to get workflow details using the R httr package. It includes setting the Authorization header with a Bearer token and specifying the workflowId. The example shows how to handle the API response in R. ```r library(httr) response <- VERB("GET", url = "https://docs.seqera.io/workflow/:workflowId", add_headers("Authorization" = "Bearer ", "Accept" = "application/json") ) content(response, "parsed") ``` -------------------------------- ### Get Workflow Logs - Go Example Source: https://docs.seqera.io/platform-api/workflow-logs This Go program retrieves workflow logs using the `net/http` package. It creates an HTTP GET request, adds the necessary `Accept` and `Authorization` headers, and sends the request to the API. The response body is then read and printed. Remember to replace `` with your Bearer token and `:workflowId` with the actual workflow identifier. ```go package main import ( "fmt" "io/ioutil" "net/http" "strings" ) func main() { workflowID := ":workflowId" token := "" url := fmt.Sprintf("https://docs.seqera.io/workflow/%s/log", workflowID) client := &http.Client{} req, err := http.NewRequest("GET", url, nil) if err != nil { fmt.Println("Error creating request: ", err) return } req.Header.Add("Accept", "application/json") req.Header.Add("Authorization", "Bearer " + token) res, err := client.Do(req) if err != nil { fmt.Println("Error sending request: ", err) return } defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil { fmt.Println("Error reading response body: ", err) return } fmt.Println(string(body)) } ``` -------------------------------- ### Example JSON for Data Studio Configuration Source: https://docs.seqera.io/platform-api/describe-data-studio This JSON object represents the configuration for a Seqera Data Studio, including session details, user information, compute environment settings, template specifications, and resource allocation. It also outlines the status and active connections for the studio. ```json { "sessionId": "string", "workspaceId": 0, "parentCheckpoint": { "checkpointId": 0, "checkpointName": "string", "sessionId": "string", "studioName": "string" }, "user": { "id": 0, "userName": "string", "email": "string", "avatar": "string" }, "name": "string", "description": "string", "studioUrl": "string", "computeEnv": { "id": "string", "name": "string", "platform": "string", "region": "string", "credentialsId": "string", "workDir": "string" }, "template": { "repository": "string", "icon": "string", "status": "recommended", "tool": "string" }, "configuration": { "gpu": 0, "cpu": 0, "memory": 0, "mountData": [ "string" ], "environment": {}, "condaEnvironment": "string", "lifespanHours": 0 }, "dateCreated": "2024-07-29T15:51:28.071Z", "lastUpdated": "2024-07-29T15:51:28.071Z", "lastStarted": "2024-07-29T15:51:28.071Z", "effectiveLifespanHours": 0, "activeConnections": [ { "id": 0, "userName": "string", "email": "string", "avatar": "string", "lastActive": "2024-07-29T15:51:28.071Z" } ], "statusInfo": { "status": "starting", "message": "string", "lastUpdate": "2024-07-29T15:51:28.071Z", "stopReason": "CREDITS_RUN_OUT" } } ``` -------------------------------- ### Get Workflow Logs - Java Example Source: https://docs.seqera.io/platform-api/workflow-logs This Java code snippet illustrates fetching workflow logs using `java.net.http.HttpClient`. It constructs an HTTP GET request to the specified endpoint, sets the `Accept` and `Authorization` headers, and sends the request. The response body is then processed. Remember to replace `` with your authentication token and `workflowId` with the actual workflow identifier. ```java HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://docs.seqera.io/workflow/:workflowId/log")) .header("Accept", "application/json") .header("Authorization", "Bearer ") .build(); client.sendAsync(request, HttpResponse.BodyHandlers.ofString()) .thenApply(HttpResponse::body) .thenAccept(System.out::println) .join(); ``` -------------------------------- ### Launch Workflow Source: https://docs.seqera.io/platform-api/describe-launch Initiates a workflow launch using a specified compute environment and configuration. ```APIDOC ## POST /launch ### Description Launches a workflow using the specified compute environment and configuration. ### Method POST ### Endpoint /launch ### Parameters #### Request Body - **id** (string) - Required - Compute environment identifier. - **computeEnv** (object) - Required - Configuration for the compute environment. - **credentialsId** (string) - Credentials identifier for compute environment authentication. - **id** (string) - Compute environment alphanumeric identifier (read-only, generated by system). - **name** (string) - Required - Unique name for the compute environment. - **description** (string) - Description of the compute environment. Maximum length: 2000 characters. - **platform** (string) - Required - Compute platform provider. - **config** (object) - Required - Platform-specific configuration. - **discriminator** (string) - Platform-specific configuration. - **workDir** (string) - Nextflow work directory. - **preRunScript** (string) - Script to execute before Nextflow. - **postRunScript** (string) - Script to execute after Nextflow. - **nextflowConfig** (string) - Additional Nextflow configuration. - **launchDir** (string) - Directory where Nextflow runs. - **userName** (string) - Username for SSH connection. - **hostName** (string) - Hostname or IP address of HPC head node. - **port** (integer) - SSH port. - **headQueue** (string) - Queue for launching Nextflow. - **computeQueue** (string) - Queue for submitting pipeline jobs. - **maxQueueSize** (integer) - Max concurrent jobs. - **headJobOptions** (string) - Options for the head job. - **propagateHeadJobOptions** (boolean) - Propagate head job options to compute jobs. - **environment** (array) - Environment variables. - **name** (string) - Required - Environment variable name. - **value** (string) - Required - Environment variable value. - **head** (boolean) - Apply to head job. - **compute** (boolean) - Apply to compute jobs. - **volumes** (array of strings) - Volumes to mount. - **region** (string) - Required - AWS region. - **computeQueue** (string) - AWS Batch compute queue. - **dragenQueue** (string) - AWS Batch queue for DRAGEN workflows. - **dragenInstanceType** (string) - EC2 instance type for DRAGEN workflows. - **computeJobRole** (string) - IAM role for AWS Batch compute jobs. - **orgId** (integer) - Organization numeric identifier (read-only). - **workspaceId** (integer) - Workspace numeric identifier (read-only). ### Request Example ```json { "id": "ce-abcdef1234567890", "computeEnv": { "name": "my-aws-batch-env", "platform": "aws-batch", "config": { "discriminator": "aws-batch", "region": "us-east-1", "computeQueue": "MyComputeQueue", "workDir": "/mnt/shared/work" } }, "orgId": 1, "workspaceId": 1 } ``` ### Response #### Success Response (200) - **id** (string) - Unique identifier for the launched workflow. #### Response Example ```json { "id": "launch-xyz789" } ``` ``` -------------------------------- ### Get Workflow Logs - Python Example Source: https://docs.seqera.io/platform-api/workflow-logs This Python code snippet demonstrates how to retrieve workflow logs using the `http.client` library. It shows how to establish a connection, set request headers including authorization, and send a GET request to the workflow log endpoint. The response is then decoded and printed. Ensure you replace '' with your actual authentication token. ```python import http.client conn = http.client.HTTPSConnection("docs.seqera.io") payload = '' headers = { 'Accept': 'application/json', 'Authorization': 'Bearer ' } conn.request("GET", "/workflow/:workflowId/log", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` -------------------------------- ### List Compute Environments (Go) Source: https://docs.seqera.io/platform-api/list-compute-envs This Go program demonstrates how to list compute environments using the `net/http` package. It sends a GET request to the /compute-envs endpoint, setting the 'Accept' and 'Authorization' headers. Ensure you replace '' with your actual Bearer token. ```go package main import ( "fmt" "io/ioutil" "net/http" ) func main() { client := &http.Client{} req, err := http.NewRequest("GET", "https://docs.seqera.io/compute-envs", nil) if err != nil { fmt.Println(err) return } req.Header.Add("Accept", "application/json") req.Header.Add("Authorization", "Bearer ") res, err := client.Do(req) if err != nil { fmt.Println(err) return } defer res.Body.Close() body, err := ioutil.ReadAll(res.Body) if err != nil { fmt.Println(err) return } fmt.Println(string(body)) } ``` -------------------------------- ### Google Cloud Batch Configuration Source: https://docs.seqera.io/platform-api/describe-workflow-launch Configure a compute environment using Google Cloud Batch. ```APIDOC ## Google Cloud Batch Configuration ### Description Configure a compute environment to run workflows on Google Cloud Batch. ### Method (Not specified, assumed to be part of a larger configuration POST/PUT request) ### Endpoint (Not specified) ### Parameters #### Query Parameters (None specified) #### Request Body - **region** (string) - Required - The GKE cluster region or zone. - **clusterName** (string) - Required - The GKE cluster name. - **fusion2Enabled** (boolean) - Whether Fusion2 is enabled. - **waveEnabled** (boolean) - Whether Wave is enabled. - **location** (string) - Required - Google Cloud location (region) for Batch jobs (e.g., `us-central1`). - **workDir** (string) - Required - The working directory for workflows. - **spot** (boolean) - Whether to use Spot instances. - **bootDiskSizeGb** (integer) - Boot disk size in GB for compute instances. - **cpuPlatform** (string) - Google Cloud Batch CPU platform. - **machineType** (string) - Machine type for compute instances (e.g., `n1-standard-4`). - **projectId** (string) - Google Cloud project ID. - **sshDaemon** (boolean) - Enable SSH daemon for debugging. - **sshImage** (string) - Container image for SSH daemon. - **debugMode** (integer) - Debug level (0-3) for troubleshooting. - **copyImage** (string) - Container image for copying files. - **usePrivateAddress** (boolean) - Use private IP addresses only (no external IPs). - **labels** (object) - Comma-separated list of labels to apply to Batch resources. - **property name*** (string) - Label key-value pair. - **preRunScript** (string) - Add a script that executes prior to invoking Nextflow processes. - **postRunScript** (string) - Add a script that executes after all Nextflow processes have completed. - **headJobCpus** (integer) - Number of CPUs allocated for the Nextflow head job. - **headJobMemoryMb** (integer) - Memory allocation for the Nextflow head job in megabytes. - **nextflowConfig** (string) - Additional Nextflow configuration to apply. - **nfsTarget** (string) - NFS server target for shared storage. - **nfsMount** (string) - NFS mount path in containers. - **environment** (object[]) - Array of environment variables. - **name** (string) - Required - Environment variable name. - **value** (string) - Required - Environment variable value. - **head** (boolean) - Apply this variable to the Nextflow head job. - **compute** (boolean) - Apply this variable to the Nextflow compute jobs. - **waveEnabled** (boolean) - Enable Wave containers. Default: `false`. - **fusion2Enabled** (boolean) - Enable Fusion file system. Requires Wave containers. Default: `false`. - **serviceAccount** (string) - Specify a service account email address. - **network** (string) - VPC network name. - **subnetwork** (string) - Subnetwork name within the VPC. - **headJobInstanceTemplate** (string) - VM instance template for the Nextflow head job. - **computeJobsInstanceTemplate** (string) - VM instance template for Nextflow compute jobs. - **allowBuckets** (string[]) - Comma-separated list of S3 buckets accessible to the compute environment. ### Request Example ```json { "region": "us-central1", "clusterName": "my-gke-cluster", "location": "us-central1", "workDir": "gs://my-bucket/work", "headJobCpus": 2, "headJobMemoryMb": 4096, "environment": [ { "name": "MY_VAR", "value": "my_value", "head": true, "compute": true } ] } ``` ### Response #### Success Response (200) (Details not specified) #### Response Example (Not specified) ```