Skip to content

FilesAsUserApi

All URIs are relative to http://localhost

Method HTTP request Description
GetFileAsUser GET /api/v1/as-user/files/{id}/download Retrieve a file by ID (accession)
GetFileMetadataByIdAsUser GET /api/v1/as-user/files/{id} Retrieve file's metadata by ID (accession)
GetFilesMetadataAsUser GET /api/v1/as-user/files Retrieve file's metadata by its fields
HeadFileAsUser HEAD /api/v1/as-user/files/{id}/download Check if a file exists by ID (accession).

GetFileAsUser

data.frame GetFileAsUser(id, range = var.range)

Retrieve a file by ID (accession)

Download a file by its accession.

Example

library(odmApi)

# Retrieve a file by ID (accession)
#
# prepare function argument(s)
var_id <- "id_example" # character | Unique identifier (accession) of the object.
var_range <- "bytes=0-" # character | Request a specific range of bytes to support partial downloads. Example: `bytes=0-1024` to download the first 1024 bytes. Supplying several ranges is not supported.  (Optional)

api_instance <- FilesAsUserApi$new()
# Configure API key authorization: Access-token
api_instance$api_client$api_keys["Authorization"] <- Sys.getenv("API_KEY")
# Configure API key authorization: Genestack-API-Token
# api_instance$api_client$api_keys["Genestack-API-Token"] <- Sys.getenv("API_KEY")
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# result <- api_instance$GetFileAsUser(var_id, range = var_rangedata_file = "result.txt")
result <- api_instance$GetFileAsUser(var_id, range = var_range)
dput(result)

Parameters

Name Type Description Notes
id character Unique identifier (accession) of the object.
range character Request a specific range of bytes to support partial downloads. Example: `bytes=0-1024` to download the first 1024 bytes. Supplying several ranges is not supported. [optional]

Return type

data.frame

Authorization

Access-token, Genestack-API-Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/octet-stream

HTTP response details

Status code Description Response headers
200 File downloaded successfully -
206 Partial content downloaded successfully -
400 File cannot be retrieved. -
401 User is not authenticated. Please supply a valid Access Token in the `Authorization` HTTP header (e.g. Authorization: bearer [token]) or Genestack API token in the `Genestack-API-Token` header (this token may be obtained from the Genestack UI Profile page). -
404 No object exists with the given ID. -
406 File cannot be downloaded. -
500 An internal server error occurred. This indicates an unexpected failure in the Genestack system, please file a bug report to support@genestack.com, including the error details. -

GetFileMetadataByIdAsUser

object GetFileMetadataByIdAsUser(id, include_contents = FALSE)

Retrieve file's metadata by ID (accession)

Example

library(odmApi)

# Retrieve file's metadata by ID (accession)
#
# prepare function argument(s)
var_id <- "id_example" # character | Unique identifier (accession) of the object.
var_include_contents <- FALSE # character | Select `true` in order to include file structure (contents) for .h5, .h5ad, .zip, .gz to the response. (Optional)

api_instance <- FilesAsUserApi$new()
# Configure API key authorization: Access-token
api_instance$api_client$api_keys["Authorization"] <- Sys.getenv("API_KEY")
# Configure API key authorization: Genestack-API-Token
# api_instance$api_client$api_keys["Genestack-API-Token"] <- Sys.getenv("API_KEY")
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# result <- api_instance$GetFileMetadataByIdAsUser(var_id, include_contents = var_include_contentsdata_file = "result.txt")
result <- api_instance$GetFileMetadataByIdAsUser(var_id, include_contents = var_include_contents)
dput(result)

Parameters

Name Type Description Notes
id character Unique identifier (accession) of the object.
include_contents character Select `true` in order to include file structure (contents) for .h5, .h5ad, .zip, .gz to the response. [optional] [default to FALSE]

Return type

object

Authorization

Access-token, Genestack-API-Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 The request was successful. The returned value is the object. -
400 Invalid data in the request. See the error message for details. -
401 User is not authenticated. Please supply a valid Access Token in the `Authorization` HTTP header (e.g. Authorization: bearer [token]) or Genestack API token in the `Genestack-API-Token` header (this token may be obtained from the Genestack UI Profile page). -
404 Object with provided accession could not be found in ODM. -
500 An internal server error occurred. This indicates an unexpected failure in the Genestack system, please file a bug report to support@genestack.com, including the error details. -

GetFilesMetadataAsUser

ListResponse GetFilesMetadataAsUser(filter = var.filter, query = var.query, include_contents = FALSE, page_limit = var.page_limit, page_offset = var.page_offset)

Retrieve file's metadata by its fields

Metadata full-text queries Single words can be supplied as is, otherwise use speech marks (\") to quote queries that include whitespace. Speech marks and backslash characters in the query need to be escaped with a backslash (\\). ## Paging For performance reasons, this endpoint returns results in \"pages\" of limited size. In order to retrieve all matching results the client needs to request multiple pages starting from an offset to the first result. You can do this using the pageOffset query parameter. A value of 0 (the default) instructs the server to return the first page of results, 100 would return a page of results starting from the 101st result and so on. To retrieve all results, iterate through pages by increasing the offset in multiples of limit (e.g., offset = n * limit), until all results have been retrieved. The total number of pages can be calculated by dividing the total number of results by the limit. ## List operation This endpoint can be called without any query parameters. When called this way, it returns a list of all files metadata objects.

Example

library(odmApi)

# Retrieve file's metadata by its fields
#
# prepare function argument(s)
var_filter <- "filter_example" # character | Filter by files metadata (key-value metadata pair(s)). (Optional)
var_query <- "query_example" # character | Search for files via a full-text query over all file metadata. (Optional)
var_include_contents <- FALSE # character | Select `true` in order to include file structure (contents) for .h5, .h5ad, .zip, .gz to the response. (Optional)
var_page_limit <- 56 # integer | Maximum number of results to return per page (see Paging above). This value must be between 0 and 2000 (inclusive). The default is 2000. (Optional)
var_page_offset <- 56 # integer | Show the page {pageOffset + 1} results from the start of the results. E.g. 100 will show a page of results starting from the 101st result. The default value is 0. (Optional)

api_instance <- FilesAsUserApi$new()
# Configure API key authorization: Access-token
api_instance$api_client$api_keys["Authorization"] <- Sys.getenv("API_KEY")
# Configure API key authorization: Genestack-API-Token
# api_instance$api_client$api_keys["Genestack-API-Token"] <- Sys.getenv("API_KEY")
# to save the result into a file, simply add the optional `data_file` parameter, e.g.
# result <- api_instance$GetFilesMetadataAsUser(filter = var_filter, query = var_query, include_contents = var_include_contents, page_limit = var_page_limit, page_offset = var_page_offsetdata_file = "result.txt")
result <- api_instance$GetFilesMetadataAsUser(filter = var_filter, query = var_query, include_contents = var_include_contents, page_limit = var_page_limit, page_offset = var_page_offset)
dput(result)

Parameters

Name Type Description Notes
filter character Filter by files metadata (key-value metadata pair(s)). [optional]
query character Search for files via a full-text query over all file metadata. [optional]
include_contents character Select `true` in order to include file structure (contents) for .h5, .h5ad, .zip, .gz to the response. [optional] [default to FALSE]
page_limit integer Maximum number of results to return per page (see Paging above). This value must be between 0 and 2000 (inclusive). The default is 2000. [optional]
page_offset integer Show the page {pageOffset + 1} results from the start of the results. E.g. 100 will show a page of results starting from the 101st result. The default value is 0. [optional]

Return type

ListResponse

Authorization

Access-token, Genestack-API-Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, text/tab-separated-values

HTTP response details

Status code Description Response headers
200 The request was successful. The returned value is a list of objects. -
400 Invalid data in the request. See the error message for details. -
401 User is not authenticated. Please supply a valid Access Token in the `Authorization` HTTP header (e.g. Authorization: bearer [token]) or Genestack API token in the `Genestack-API-Token` header (this token may be obtained from the Genestack UI Profile page). -
500 An internal server error occurred. This indicates an unexpected failure in the Genestack system, please file a bug report to support@genestack.com, including the error details. -

HeadFileAsUser

HeadFileAsUser(id)

Check if a file exists by ID (accession).

Check if a file exists by its accession. This endpoint can be used to check if a file exists and accessible before downloading it.

Example

library(odmApi)

# Check if a file exists by ID (accession).
#
# prepare function argument(s)
var_id <- "id_example" # character | Unique identifier (accession) of the object.

api_instance <- FilesAsUserApi$new()
# Configure API key authorization: Access-token
api_instance$api_client$api_keys["Authorization"] <- Sys.getenv("API_KEY")
# Configure API key authorization: Genestack-API-Token
# api_instance$api_client$api_keys["Genestack-API-Token"] <- Sys.getenv("API_KEY")
api_instance$HeadFileAsUser(var_id)

Parameters

Name Type Description Notes
id character Unique identifier (accession) of the object.

Return type

void (empty response body)

Authorization

Access-token, Genestack-API-Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

HTTP response details

Status code Description Response headers
200 File exists. Additional metadata is provided in the response headers. -
400 File cannot be downloaded. -
401 User is not authenticated. Please supply a valid Access Token in the `Authorization` HTTP header (e.g. Authorization: bearer [token]) or Genestack API token in the `Genestack-API-Token` header (this token may be obtained from the Genestack UI Profile page). -
404 No object exists with the given ID. -
406 File cannot be downloaded. -
500 An internal server error occurred. This indicates an unexpected failure in the Genestack system, please file a bug report to -