Data Asset API
Prerequisites
Generated Token with Datasets Scope
The Data Asset's ID
You can find Data Asset's ID below the title.
created
float64
Data Asset creation time
description
string
Data Asset description
field
string
field of research
id
integer
metadata id
lastUsed
integer
the time this Data Asset was last used in seconds from unix epoch.
name -
string
name of the Data Asset
size
string
the size in bytes of the Data Asset.
state
boolean
the Data Asset creation state
DATA_ASSET_STATE_DRAFT
the Data Asset is still being created.
DATA_ASSET_STATE_READY
the Data Asset is ready to use.
DATA_ASSET_STATE_FAILED
the Data Asset creation failed
source_bucket
information on bucket from which Data Asset was created.
bucket
the original buckets name
origin
aws/local/gcp
prefix
the folder in the s3 bucket from which the Data Asset would be created.
tags
keywords for searching the Data Asset by.
type
the type of the Data Asset.
DATA_ASSET_TYPE_DATASET
DATA_ASSET_TYPE_RESULT
custom_metadata
map of key value pairs, according to custom metadata fields defined by the admin and values that were set by the user.
provenance
shows the Data Asset provenance, only relevant for kind = result.
commit
the commit the Data Asset was created from with.
runScript
the script the Data Asset was created by.
DataAssets
datasets that was used to create the Data Asset.
DockerImage
the docker image used to create the Data Asset.
Capsule
the Capsule used to create the Data Asset.
app_parameters
the list of command-line arguments and their names provided to the Capsule run script in the related computation.
items
name
parameter name
value
parameter value
Create Data Asset
POST
https://{domain}/api/v1/data_assets
This API allows for the creation of data assets from either an S3 bucket or the results of a computation.
Prerequisite
Before using this API call, you may require AWS Cloud Credentials configured as Secrets or an Assumable Role.
Path Parameters
Name | Type | Description |
---|---|---|
POST* |
| /datasets |
Headers
Name | Type | Description |
---|---|---|
-u:* |
| Authorize with Code Ocean API Secret: -u $API_SECRET : This is setting the "Authorization Basic" base64string header |
-H* |
| Set this to: Content - Type: application/json |
--data-raw * |
| JSON data with new or updated permission |
Request Body
Name | Type | Description |
---|---|---|
name* | string | data asset name |
description* | string | data asset description |
mount* | string | data asset default mount folder |
tags* | list/string | keywords for searching the data asset by |
Custom Metadata |
| map of key value pairs, according to custom metadata fields defined by the admin, possible values: - custom field: string - custom field: number - custom field: date |
source* |
| |
aws* |
|
|
Bucket* |
| the S3 bucket from which the data asset would be created - bucket name |
Prefix* |
| the folder in the S3 bucket from which the data asset would be created - directory path |
Keep_on_external_storage* | boolean | when this property is set to true an External Data Asset will be created. When this property is set to false or excluded, the data asset files are copied into Code Ocean and an Internal Data Asset is created. |
Public* | boolean | when this property is set to true, CO will try to access the source bucket without credentials |
computation |
|
|
id | string | computation ID |
path | string | path to a folder in Results, leave empty to capture all files |
Target |
|
|
aws |
|
|
Bucket |
| The S3 bucket in which the result files will be stored. Specifying this parameter will create an external result data asset |
Prefix |
| The folder in the S3 bucket in which the data asset will be created |
Create a Data Asset from a Public S3 Bucket
Create a Data Asset from a Private S3 Bucket
Create an External Result Data Asset
Create a Result Data Asset
Create a Data Asset with Custom Metadata Tags
API only returns a confirmation of the validity of the creation request, not the success of the creation, since the creation takes time. Poll on the dataset details and monitor its state until it’s ready.
Get Dataset
GET
https://{domain}/api/v1/data_assets/{data_set_id}
This API retrieves metadata for your data asset.
Path Parameters
Name | Type | Description |
---|---|---|
GET * |
| /data_assets/:data_asset_id |
Headers
Name | Type | Description |
---|---|---|
-u* | String | Authorize with Code Ocean API Secret: -u $API_SECRET : This is setting the "Authorization Basic" base64string header |
-H* | String | Set this to: Content - Type: application/json |
Update Metadata
PUT
https://{domain}/api/v1/data_assets/{data_set_id}
This API allows for the updating of the metadata for your data asset.
Path Parameters
Name | Type | Description |
---|---|---|
PUT* |
| /data_assets/:data_asset_id Your VPC domain |
Headers
Name | Type | Description |
---|---|---|
-u* |
| Authorize with Code Ocean API Secret: -u $API_SECRET : This is setting the "Authorization Basic" base64string header |
-H* |
| Set this to: Content - Type: application/json |
--data-raw* |
| JSON with parameters |
Request Body
Name | Type | Description |
---|---|---|
name* | string | The name of the data asset |
description* | string | A description for the data asset |
tags* | string | Keywords to search the data asset by |
mount* | string | Data asset default mount folder |
custom_metadata |
| Map of key value pairs, should match custom metadata fields defined by the admin's possible values: string custom field - string number custom field - number date custom field - number - unix (epoch) format timestamp in secs |
Archiving/Unarchiving a Dataset
PATCH
https://{domain}/api/v1/data_assets/{data_set_id}/archive?archive=true
This API allows for the archiving and retrieval of your data asset.
Path Parameters
Name | Type | Description |
---|---|---|
PATCH* |
| /data_assets/:data_asset_id Your VPC domain |
Headers
Name | Type | Description |
---|---|---|
-u* |
| Authorize with Code Ocean API Secret: -u $API_SECRET : This is setting the "Authorization Basic" base64string header |
-H* |
| Set this to: Content - Type: application/json |
Search Data Assets
POST
https://{domain}/api/v1/data_assets/search
This API allows for the searching of Data Assets in your deployment.
Path Parameters
Name | Type | Description |
---|---|---|
POST* |
| /datasets/search |
Headers
Name | Type | Description |
---|---|---|
-u:* |
| Authorize with Code Ocean API Secret: -u $API_SECRET : This is setting the "Authorization Basic" base64string header |
-H* |
| Set this to: Content - Type: application/json |
--data-raw * |
| JSON with parameters |
Request Body
Name | Type | Description |
---|---|---|
offset* | int | describes the search from index. |
limit* | int | specifies how many items to return. |
sort_order | string | asc,desc determines the result search order. must be provided with sort_field otherwise ignored. |
sort_field | string | created,type,name,size determines the field to sort by. |
type | string | dataset, result if omitted results may include both Data Assets and Results. |
ownership* | string | created, shared search Data Asset by ownership. |
favorite* | boolean | search only favorite Data Assets. |
archived* | boolean | search only archived Data Assets. |
query* | string | determines the search query. format name: .. tag: ... run_script: ... commit_id: ... |
Update Permissions of a Data Asset
POST
https://{domain}/api/v1/data_assets/{data_set_id}/permissions
This API allows for the updating of permissions associated with a Data Assets in your deployment.
Path Parameters
Name | Type | Description |
---|---|---|
POST* |
| /data_assets/{data_set_id}/permissions |
Headers
Name | Type | Description |
---|---|---|
-u:* |
| Authorize with Code Ocean API Secret: -u $API_SECRET : This is setting the "Authorization Basic" base64string header |
-H* |
| Set this to: Content - Type: application/json |
--data-raw * |
| JSON with parameters |
Request Body
Name | Type | Description |
---|---|---|
users* | array<dict> | list of dictionaries with username and role. role : owner, viewer, editor. |
groups* | array<dict> | list of dictionaries with groups and roles |
everyone* | string | viewer or none |
Last updated