Data Asset API
Last updated
Was this helpful?
Last updated
Was this helpful?
Token with datasets scope
The data asset's ID to pass to the API call
You can find the data asset's ID below the title
POST
https://{domain}codeocean.com/api/v1/data_assets
{domain}*
String
Your VPC domain
Content-Type*
String
application/json
-u*
String
\ '${API Token from Code Ocean}:\' \
name*
String
The name of the data asset.
description*
String
A description for the data asset.
mount*
String
A folder under the capsule data folder, where the data asset files are found.
tags*
array
Keywords to search the data asset by.
source*
String
Where the data asset originated. Currently only AWS is supported.
source.aws*
String
Describes the S3 bucket from which the data asset was created.
source.aws.access_key_id
String
The AWS key ID used to access the S3 bucket. Not required if it is a public S3 bucket.
source.aws.secret_access_key
String
The AWS secret access key ID used to access the S3 bucket. Not required if it is a public S3 bucket.
source.aws.bucket*
String
The S3 bucket from which the data asset will be created.
source.aws.prefix*
boolean
The folder in the S3 bucket from which the data asset is created. This is only relevant when copying the files over to Code Ocean (keep_on_external_storage=false).
source.aws.keep_on_External_storage*
boolean
When set to true, the data asset files will not be copied over to Code Ocean. The prefix property will be ignored and the entire S3 bucket will be used.
source.aws.index_data*
boolean
When this property is true Code Ocean will index the files in the remote bucket to display the file tree in the dataset and capsule pages. This is only relevant when keep_on_external_storage is set to true. When keep_on_external_storage is false Code Ocean will always index the files.
The examples here are executed from a capsule that utilizes the secret management feature. The API token was added as "Custom Key" and the AWS credential was added as "AWS Cloud Credential"
GET
https://{domain}.codeocean.com/api/v1/data_assets/{data assets ID}'
{domain}*
String
Your VPC domain
{data assets ID}*
String
The dataset ID that you want to get the metadata from
Authorization*
String
Basic ${API Token from Code Ocean}
GET
https://{domain}.codeocean.com/api/v1/data_assets/{data assets ID}'
{domain}*
String
Your VPC domain
start
int
describes the search from index
limit
int
sort_field
String
option: created/type/name/size
determines the field to sort by
sort_order
String
option: asc/desc
determines the result sort order. must be provided with sort_field, otherwise ignored
query
String
determines the search query. can be a free text or in the form of “name:... tag:... run_script:... commit_id:...”
type
String
option: dataset/result
if omitted results may include both datasets and results
ownership
String
option: owner/shared
search data asset by ownership
favorite
boolean
search only favorite data assets
archived
boolean
search only archived data assets
-u*
String
\ '${API Token from Code Ocean}:\' \
PUT
https://{domain}.codeocean.com/api/v1/data_assets/{data_set_id}
{domain}*
String
Your VPC domain
{data_set_id}*
String
Data Asset's id
-u*
String
\ '${API Token from Code Ocean}:\' \
name*
String
data asset name
description*
String
data asset description
tags
array
array of string tags
mount
String
default mount folder
DELETE
https://{domain}.codeocean.com/api/v1/data_assets/{data_set_id}
{domain}*
String
Your VPC domain
{data_set_id}*
String
Data Asset's id
-u*
String
\ '${API Token from Code Ocean}:\' \
PATCH
https://{domain}.codeocean.com/api/v1/data_assets/{data_set_id}/archive?archive=true
{domain}*
String
Your VPC domain
{data_set_id}*
String
Data Asset's id
archive*
Boolean
If true will archive a data asset. Otherwise will unarchive it.
-u*
String
\ '${API Token from Code Ocean}:\' \