API clients handle the underlying details of how network requests are made and how responses are decoded. We are using Core API which is a format-independent Document Object Model for representing Web APIs. It is recommended to use the Core API clients described below for a more robust and intuitive way to interact with the UniBind API rather than constructing HTTP requests and decoding responses.

Currently, Core API provides three clients:

As a way of getting started, you can interact with the UniBind API using the sample calls provided below.

Command line client

# Install the command line client
$ pip install coreapi-cli
To interact with the API:
# Load the schema document
$ coreapi get https://unibind.uio.no/api/v1/docs

# Interact with the API endpoint
$ coreapi action matrix list -p page=... -p page_size=... -p search=... -p order=... -p collection=... -p name=... -p tax_group=... -p tax_id=... -p tf_class=... -p tf_family=... -p data_type=... -p version=... -p release=...

# For example
coreapi action matrix list -p collection=CORE -p tax_group=vertebrates -p version=latest -p name=SMAD3

Python client

# Install the Python client library
$ pip install coreapi
To interact with the API:
import coreapi

# Initialize a client & load the schema document
client = coreapi.Client()
schema = client.get("https://unibind.uio.no/api/v1/docs")

# Interact with the API endpoint
action = ["matrix", "list"]
params = {
    "page": ...,
    "page_size": ...,
    "search": ...,
    "order": ...,
    "collection": ...,
    "name": ...,
    "tax_group": ...,
    "tax_id": ...,
    "tf_class": ...,
    "tf_family": ...,
    "data_type": ...,
    "version": ...,
    "release": ...,
}
result = client.action(schema, action, params=params)

# For example
params = {
    "collection": 'CORE',
    "name": 'SMAD3',
    "tax_group": 'vertebrates',
    "version": 'latest',
    "release": '2018',
}
result = client.action(schema, action, params=params)

JavaScript client

<!-- Load the JavaScript client library -->
<script src="https://unibind.uio.no/static/rest_framework/js/coreapi-0.1.0.js"></script>
<script src="https://unibind.uio.no/api/v1/docs/schema.js"></script>
To interact with the API:
var coreapi = window.coreapi  // Loaded by `coreapi.js`
var schema = window.schema    // Loaded by `schema.js`

// Initialize a client
var client = new coreapi.Client()

// Interact with the API endpoint
var action = ["matrix", "list"]
var params = {
    page: ...,
    page_size: ...,
    search: ...,
    order: ...,
    collection: ...,
    name: ...,
    tax_group: ...,
    tax_id: ...,
    tf_class: ...,
    tf_family: ...,
    data_type: ...,
    version: ...,
    release: ...,
}
client.action(schema, action, params).then(function(result) {
    // Return value is in 'result'
})

Sample calls

These are sample calls to API from different languages. You can create the query url by using our Live API