Skip to content

CenterForMedicalGeneticsGhent/drs_api_sdk

Repository files navigation

drs-api

GET request: - Fetch a DrsObject from the database by sending a unique ID through the request - Fetch an access url to the data which the object refers to - Fetch DrsObjects by doing a search on the aliases POST request: - Create a non-existing DrsObject in the database by giving an identifier DELETE request: - Delete a DrsObject from the database by unique identifier PUT request: - Update an existing DrsObject by unique identifier and the changes in the body

This Python package is automatically generated by the Swagger Codegen project:

  • API version: 1.2.0
  • Package version: 1.1.0
  • Build package: io.swagger.codegen.v3.generators.python.PythonClientCodegen

Requirements.

Python 2.7 and 3.4+

Installation & Usage

pip install

If the python package is hosted on Github, you can install directly from Github

pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git)

Then import the package:

import drs_api 

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import drs_api

Getting Started

Please follow the installation procedure and then run the following:

from __future__ import print_function
import time
import drs_api
from drs_api.rest import ApiException
from pprint import pprint

# Configure OAuth2 access token for authorization: OAuth2PasswordBearer
configuration = drs_api.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = drs_api.DataRepositoryServiceApi(drs_api.ApiClient(configuration))
object_id = 'object_id_example' # str | 

try:
    # Delete a DrsObject
    api_response = api_instance.delete_object_ga4gh_drs_v1_objects_object_id_delete(object_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DataRepositoryServiceApi->delete_object_ga4gh_drs_v1_objects_object_id_delete: %s\n" % e)

# Configure OAuth2 access token for authorization: OAuth2PasswordBearer
configuration = drs_api.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = drs_api.DataRepositoryServiceApi(drs_api.ApiClient(configuration))
alias = ['alias_example'] # list[str] | The alias(ses) on which to query DrsObjects (regex compatible)

try:
    # Query DrsObjects on alias
    api_response = api_instance.get_object_alias_ga4gh_drs_v1_objects_get(alias)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DataRepositoryServiceApi->get_object_alias_ga4gh_drs_v1_objects_get: %s\n" % e)

# Configure OAuth2 access token for authorization: OAuth2PasswordBearer
configuration = drs_api.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = drs_api.DataRepositoryServiceApi(drs_api.ApiClient(configuration))
object_id = 'object_id_example' # str | ```DrsObject``` identifier
access_id = 'access_id_example' # str | An `access_id` from the `access_methods` list of a `DrsObject`

try:
    # Get a URL for fetching bytes
    api_response = api_instance.get_object_ga4gh_drs_v1_objects_object_id_access_access_id_get(object_id, access_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DataRepositoryServiceApi->get_object_ga4gh_drs_v1_objects_object_id_access_access_id_get: %s\n" % e)

# Configure OAuth2 access token for authorization: OAuth2PasswordBearer
configuration = drs_api.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = drs_api.DataRepositoryServiceApi(drs_api.ApiClient(configuration))
object_id = 'object_id_example' # str | ```DrsObject``` identifier
expand = true # bool | If false and the object_id refers to a bundle, then the ContentsObject array contains only         those objects directly contained in the bundle. That is, if the bundle contains other bundles,         those other bundles are not recursively included in the result. If true and the object_id refers to a bundle,         then the entire set of objects in the bundle is expanded. That is, if the bundle contains aother bundles,         then those other bundles are recursively expanded and included in the result.         Recursion continues through the entire sub-tree of the bundle.         If the object_id refers to a blob, then the query parameter is ignored.

try:
    # Retrieve a DrsObject
    api_response = api_instance.get_object_ga4gh_drs_v1_objects_object_id_get(object_id, expand)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DataRepositoryServiceApi->get_object_ga4gh_drs_v1_objects_object_id_get: %s\n" % e)

# Configure OAuth2 access token for authorization: OAuth2PasswordBearer
configuration = drs_api.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = drs_api.DataRepositoryServiceApi(drs_api.ApiClient(configuration))
body = drs_api.DrsObject() # DrsObject | 

try:
    # Create a new DrsObject
    api_response = api_instance.post_object_ga4gh_drs_v1_objects_post(body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DataRepositoryServiceApi->post_object_ga4gh_drs_v1_objects_post: %s\n" % e)

# Configure OAuth2 access token for authorization: OAuth2PasswordBearer
configuration = drs_api.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = drs_api.DataRepositoryServiceApi(drs_api.ApiClient(configuration))
body = drs_api.DrsObject() # DrsObject | 
object_id = 'object_id_example' # str | 

try:
    # Update a DrsObject
    api_response = api_instance.put_object_ga4gh_drs_v1_objects_object_id_put(body, object_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DataRepositoryServiceApi->put_object_ga4gh_drs_v1_objects_object_id_put: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to /

Class Method HTTP request Description
DataRepositoryServiceApi delete_object_ga4gh_drs_v1_objects_object_id_delete DELETE /ga4gh/drs/v1/objects/{object_id} Delete a DrsObject
DataRepositoryServiceApi get_object_alias_ga4gh_drs_v1_objects_get GET /ga4gh/drs/v1/objects Query DrsObjects on alias
DataRepositoryServiceApi get_object_ga4gh_drs_v1_objects_object_id_access_access_id_get GET /ga4gh/drs/v1/objects/{object_id}/access/{access_id} Get a URL for fetching bytes
DataRepositoryServiceApi get_object_ga4gh_drs_v1_objects_object_id_get GET /ga4gh/drs/v1/objects/{object_id} Retrieve a DrsObject
DataRepositoryServiceApi post_object_ga4gh_drs_v1_objects_post POST /ga4gh/drs/v1/objects Create a new DrsObject
DataRepositoryServiceApi put_object_ga4gh_drs_v1_objects_object_id_put PUT /ga4gh/drs/v1/objects/{object_id} Update a DrsObject
HealthApi get_health_health_get GET /health Check if the API is running correctly
LoginApi login_token_post POST /token Login

Documentation For Models

Documentation For Authorization

OAuth2PasswordBearer

  • Type: OAuth
  • Flow: password
  • Authorization URL:
  • Scopes:

Author

ict@cmgg.be