Capsule

Prerequisites

You can find the Capsule's ID in metadata.

  • id string

    Capsule ID

  • created int64 Capsule creation time

  • name string

    Capsule display name

  • status enum

    Sttatus of the Capsule

    • non_published, submitted, publishing, published, verified

  • owner string

    Capsule owner’s ID

  • slug string

    Alternate Capsule ID

  • description string

    Capsule description

  • field string

    Capsule research field

  • original_capsule dictionary (Optional)

    Original Capsule Info

    • id string

      Original Capsule id

    • major_version integer

      Original Capsule major version

    • minor_version integer Original Capsule minor version

    • name string

      Original Capsule name

    • created int64

      Original Capsule creation data

    • public boolean

      Indicates whether the original Capsule is public

  • published_capsule string (Optional)

    Published Capsule ID

  • submission dictionary (Optional)

    • timestamp int64

      Submission time

    • commit string

      Submission commit hash

    • verification_capsule string

      Verification Capsule ID

    • verified boolean

      Indicates whether the Capsule was verified

    • verified_timestamp int64

      Verification time

  • versions dictionary (Optional)

    Capsule versions

    • major_version integer

      The Capsule major version

    • minor_version integer

      The Capsule minor version

    • publish_time int64

      The version publishing time

    • doi string

      Version DOI

  • keywords list<string> (Optional)

  • article dictionary (Optional)

    Capsule article info.

    • url string

      Article URL

    • id string

      Article ID

    • doi string

      Article DOI

    • citation string

      Article citation

    • state enum

      Article state

      • in_review, published

    • name string

      Article name

    • journal_name string

      Articles journal name

    • publish_time int64

      Article publish time

Get Capsule

GET https://{domain}/api/v1/capsules/{capsule_id}

This API allows for the retrieval of the metadata for your Capsule.

Path Parameters

NameType

capsule_id*

string

Scope

TypePermission

Capsule

Read

Request Example Bash
curl https://{domain}/api/v1/capsules/4bc97533-6eb4-48ac-966f-648548a756d2 \
  -u "cop_d23dasd312"
Request Example Python SDK
capsule = client.capsules.get_capsule(capsule_id="4bc97533-6eb4-48ac-966f-648548a756d2")
Response

Listing Capsule Computations

GET https://{domain}/api/v1/capsules/{capsule_id}/computations

This API allows for the retrieval of Computations from a Capsule.

Path Parameters

NameType

capsule_id*

string

Scope

TypePermission

Capsule

Read

Request Example Bash
curl https://{domain}/api/v1/capsules/4bc97533-6eb4-48ac-966f-648548a756d2/computations \
   -u "cop_d23dasd312"
Request Example Python SDK
computations = client.capsules.list_computations(capsule_id="zv082356-a032-1b97-90b0-f209b8728927")
Response

Attach Data Assets

POST https://{domain}/api/v1/capsules/{capsule_id}/data_assets

Path Parameters

NameType

capsule_id*

string

Request Body

List of DataAssetAttachParams:

NameTypeDescription

id*

string

Data Asset ID

mount

string

(Optional)

Folder to mount data

Scope

TypePermission

Capsule

Read and Write

Data Asset

Read and Write

Request Example Bash
curl -X POST https://{domain}/api/v1/capsules/4367940-e863-4819-afbd-1b6b9f9b1256/data_assets \
   -u "cop_d23dasd312" \
   -H "Content-Type: application/json" \
   --data-raw '[
     {"id": "052b6c02-2b81-4eca-b064-5e886c806ebe"},
     {"id": "9378e12a-f349-4f07-8f4b-9e64b8b8b514"}
   ]'
Request Example Python SDK
from codeocean.data_asset import DataAssetAttachParams

data_assets = [
    DataAssetAttachParams(id="1fa0c990-3b5c-402f-ab3c-00cac6eed21e"),
    DataAssetAttachParams(id="1az0c240-1a9z-192b-pa4c-22bac5ffa17b", mount="Reference"),
]        
        
results = client.capsules.attach_data_assets(
    capsule_id="zv082356-a032-1b97-90b0-f209b8728927",
    attach_params=data_assets,
)
Response

List of DataAssetAttachResults:

  • external boolean

    indicates whether the data asset is external

  • id string

    data asset ID

  • job_id string

    for internal use

  • mount string

    name of folder to mount the data asset

  • mount_state string

    for internal use

  • ready boolean

    data asset is attached and ready for use in capsule

Detach Data Assets

DELETE https://{domain}/api/v1/capsules/{capsule_id}/data_assets

This API detaches one or many Data Assets from a Capsule/Pipeline.

Prerequisite

Before using this API call, you may need AWS Cloud Credentials configured as Secrets or an Assumable Role, if you are using Data Assets from Cloud Sources.

Path Parameters

NameType

capsule_id*

string

Request Body

List of Data Asset IDs to deatach.

Scope

TypePermission

Capsule

Read and Write

Data Asset

Read and Write

Request Example Bash
curl -X DELETE https://{domain}/api/v1/capsules/a4367940-e863-4819-afbd-1b6b9f9b1256/data_assets \
  -u "cop_d23dasd312" \
  -H "Content-Type: application/json" \
  --data-raw "[
    "4ec22934-d75f-4385-9c52-c8e593a4234c",     
    "052b6c02-2b81-4eca-b064-5e886c806ebe",
    "9378e12a-f349-4f07-8f4b-9e64b8b8b514"
  ]"
Request Example Python SDK
data_assets = [
    "1fa0c990-3b5c-402f-ab3c-00cac6eed21e",
    "1az0c240-1a9z-192b-pa4c-22bac5ffa17b",
]        
        
client.capsules.detach_data_assets(
    capsule_id="zv082356-a032-1b97-90b0-f209b8728927",
    data_assets=data_assets,
)