API Overview

The JASPAR RESTful API provides programmatic and human-browsable access to JASPAR database, which is implemented in Python by using Django REST Framework.

Currently, JASPAR API have Version 1, which is available at http://jaspar.genereg.net/api/v1/. New versions will be realeased here with new URL and there will be a prior notice before obsoleting any older API version.

Our API is using throttling in order to control the rate of requests that clients can make to the API. We allow 25 requests per second from the same IP address, but no limit on the total number of requests.
Please feel free to write to us if you need higher request.

To provide a faster response to each request and to prevent larger accidental downloads, API provides pagination. Users can increase or decrease the number of records per pages by setting the page_size. By default page_size=10, which can be increased up-to 1000.

http://jaspar.genereg.net/api/v1/matrix/?page=1&page_size=25
Further, to jump from one page to another, specify the page parameter.
http://jaspar.genereg.net/api/v1/matrix/?page=2

This supports simple query parameter controlled ordering of results. The query parameter is named order.
For example, to order matrices by name:

http://jaspar.genereg.net/api/v1/matrix/?order=name
The client may also specify reverse order by prefixing the field name with '-', like so:
http://jaspar.genereg.net/api/v1/matrix/?order=-name
Multiple orderings may also be specified:
http://jaspar.genereg.net/api/v1/matrix/?order=name,version

REST API provides several data renderer types, that allow you to return responses with various media types. The query parameter is named format.
Currently, available data fromats are; json, jsonp, api, yaml, jaspar, transfac, pfm
For example, to return all the matrices in JSON format:

http://jaspar.genereg.net/api/v1/matrix/?format=json

For example, to return PFM values of matrix MA0001.1 in JASPAR format:
http://jaspar.genereg.net/api/v1/matrix/MA0001.1/?format=jaspar
The above URL will return this:
>MA0001.1 AGL3
A [  0.00   3.00  79.00  40.00  66.00  48.00  65.00  11.00  65.00   0.00]
C [ 94.00  75.00   4.00   3.00   1.00   2.00   5.00   2.00   3.00   3.00]
G [  1.00   0.00   3.00   4.00   1.00   0.00   5.00   3.00  28.00  88.00]
T [  2.00  19.00  11.00  50.00  29.00  47.00  22.00  81.00   1.00   6.00]
        

You can set the output format type in three different ways:

1. By setting ?format=format url parameter. For example;

2. By adding .format suffix. For example

3. By using the Accept headers. For example;

curl 'http://jaspar.genereg.net/api/v1/matrix/MA0001.1' -H 'Accept: application/json'
curl 'http://jaspar.genereg.net/api/v1/matrix/MA0001.1' -H 'Accept: application/javascript'
curl 'http://jaspar.genereg.net/api/v1/matrix/MA0001.1' -H 'Accept: application/yaml'
curl 'http://jaspar.genereg.net/api/v1/matrix/MA0001.1' -H 'Accept: text/html'
curl 'http://jaspar.genereg.net/api/v1/matrix/MA0001.1' -H 'Accept: text/jaspar'
curl 'http://jaspar.genereg.net/api/v1/matrix/MA0001.1' -H 'Accept: text/transfac'
curl 'http://jaspar.genereg.net/api/v1/matrix/MA0001.1' -H 'Accept: text/pfm'
curl 'http://jaspar.genereg.net/api/v1/matrix/MA0001.1' -H 'Accept: text/meme'

If there is a conflict between the Accept headers and the format parameter, the following error message will be returned;

curl 'http://jaspar.genereg.net/api/v1/matrix/?format=jsonp' -H 'Accept: application/json'
{
"detail": "Could not satisfy the request's Accept header"
}

JASPAR API also support Cross-Origin Resource Sharing (CORS), which enable users to make cross-origin API requests directly from their web application.

Setting up the cache is very useful to enhance the performance of the API. For this API, we are using Memcached, which is a fast, efficient and entirely memory-based cache server. It is used by sites such as Facebook and Wikipedia to reduce database access and dramatically increase site performance. Memcached runs as a daemon and is allotted a specified amount of RAM. All it does is provide a fast interface for adding, retrieving and deleting data in the cache. All data is stored directly in memory, so there’s no overhead of database or filesystem usage. We are using a Python Memcached binding python-memcached, which is running on localhost (127.0.0.1) port 11211,