Skip to content

odm_api.FilesAsUserApi

All URIs are relative to http://localhost

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

get_file_as_user

bytearray get_file_as_user(id, range=range)

Retrieve a file by ID (accession)

Download a file by its accession.

Example

  • Api Key Authentication (Access-token):
  • Api Key Authentication (Genestack-API-Token):
import odm_api
from odm_api.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = odm_api.Configuration(
    host = "http://localhost"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: Access-token
configuration.api_key['Access-token'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Access-token'] = 'Bearer'

# Configure API key authorization: Genestack-API-Token
configuration.api_key['Genestack-API-Token'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Genestack-API-Token'] = 'Bearer'

# Enter a context with an instance of the API client
with odm_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = odm_api.FilesAsUserApi(api_client)
    id = 'id_example' # str | Unique identifier (accession) of the object.
    range = 'bytes=0-' # str | 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)

    try:
        # Retrieve a file by ID (accession)
        api_response = api_instance.get_file_as_user(id, range=range)
        print("The response of FilesAsUserApi->get_file_as_user:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling FilesAsUserApi->get_file_as_user: %s\n" % e)

Parameters

Name Type Description Notes
id str Unique identifier (accession) of the object.
range str 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

bytearray

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. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_file_metadata_by_id_as_user

object get_file_metadata_by_id_as_user(id, include_contents=include_contents)

Retrieve file's metadata by ID (accession)

Example

  • Api Key Authentication (Access-token):
  • Api Key Authentication (Genestack-API-Token):
import odm_api
from odm_api.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = odm_api.Configuration(
    host = "http://localhost"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: Access-token
configuration.api_key['Access-token'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Access-token'] = 'Bearer'

# Configure API key authorization: Genestack-API-Token
configuration.api_key['Genestack-API-Token'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Genestack-API-Token'] = 'Bearer'

# Enter a context with an instance of the API client
with odm_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = odm_api.FilesAsUserApi(api_client)
    id = 'id_example' # str | Unique identifier (accession) of the object.
    include_contents = False # bool | Select `true` in order to include file structure (contents) for .h5, .h5ad, .zip, .gz to the response. (optional) (default to False)

    try:
        # Retrieve file's metadata by ID (accession)
        api_response = api_instance.get_file_metadata_by_id_as_user(id, include_contents=include_contents)
        print("The response of FilesAsUserApi->get_file_metadata_by_id_as_user:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling FilesAsUserApi->get_file_metadata_by_id_as_user: %s\n" % e)

Parameters

Name Type Description Notes
id str Unique identifier (accession) of the object.
include_contents bool 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. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_files_metadata_as_user

ListResponse get_files_metadata_as_user(filter=filter, query=query, include_contents=include_contents, page_limit=page_limit, page_offset=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

  • Api Key Authentication (Access-token):
  • Api Key Authentication (Genestack-API-Token):
import odm_api
from odm_api.models.list_response import ListResponse
from odm_api.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = odm_api.Configuration(
    host = "http://localhost"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: Access-token
configuration.api_key['Access-token'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Access-token'] = 'Bearer'

# Configure API key authorization: Genestack-API-Token
configuration.api_key['Genestack-API-Token'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Genestack-API-Token'] = 'Bearer'

# Enter a context with an instance of the API client
with odm_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = odm_api.FilesAsUserApi(api_client)
    filter = 'filter_example' # str | Filter by files metadata (key-value metadata pair(s)). (optional)
    query = 'query_example' # str | Search for files via a full-text query over all file metadata. (optional)
    include_contents = False # bool | Select `true` in order to include file structure (contents) for .h5, .h5ad, .zip, .gz to the response. (optional) (default to False)
    page_limit = 56 # int | 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 = 56 # int | 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)

    try:
        # Retrieve file's metadata by its fields
        api_response = api_instance.get_files_metadata_as_user(filter=filter, query=query, include_contents=include_contents, page_limit=page_limit, page_offset=page_offset)
        print("The response of FilesAsUserApi->get_files_metadata_as_user:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling FilesAsUserApi->get_files_metadata_as_user: %s\n" % e)

Parameters

Name Type Description Notes
filter str Filter by files metadata (key-value metadata pair(s)). [optional]
query str Search for files via a full-text query over all file metadata. [optional]
include_contents bool Select `true` in order to include file structure (contents) for .h5, .h5ad, .zip, .gz to the response. [optional] [default to False]
page_limit int 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 int 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. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

head_file_as_user

head_file_as_user(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

  • Api Key Authentication (Access-token):
  • Api Key Authentication (Genestack-API-Token):
import odm_api
from odm_api.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = odm_api.Configuration(
    host = "http://localhost"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: Access-token
configuration.api_key['Access-token'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Access-token'] = 'Bearer'

# Configure API key authorization: Genestack-API-Token
configuration.api_key['Genestack-API-Token'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Genestack-API-Token'] = 'Bearer'

# Enter a context with an instance of the API client
with odm_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = odm_api.FilesAsUserApi(api_client)
    id = 'id_example' # str | Unique identifier (accession) of the object.

    try:
        # Check if a file exists by ID (accession).
        api_instance.head_file_as_user(id)
    except Exception as e:
        print("Exception when calling FilesAsUserApi->head_file_as_user: %s\n" % e)

Parameters

Name Type Description Notes
id str 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 -

[Back to top] [Back to API list] [Back to Model list] [Back to README]