Genboree

HELP TOPIC: "8. REST API – Overview"




 
8.1. Introduction:

We are beginning an incremental deployment of a Genboree Application Programming Interface (API) that exposes the data entities represented within Genboree and also allows authorized users to modify stored data.

The API is based on REST principles and a Resource Oriented Architecture (ROA). This approach greatly simplifies the interface and results in predicatable consistency. We believe this also makes the learning curve less steep, compared to more 'involved' alternatives for web-services.

The API is currently being being used both by collaborators and internally. Non-Genboree users with programming skills have written scripts that assist or automate certain Genboree tasks and created their own user interfaces that use Genboree via Ajax.

We will continue to expose more Genboree entities, as well as expand method support for new and existing resources.


 
8.2. Key Aspects:
There are 4 key aspects to using the API:

 

8.2.1. Resource IDs (URIs) [details]

Data entities stored within Genboree are exposed as resources, which have a unique resource identifier (URI). Genboree resource identifiers are in fact web URLs; each URL is the location of a specific resource which you want to access, modify, or delete. Resources can be single data items or a collection (list) of multiple items.

The URLs have a general form:

http://{genbHost}/{rsrcPath}?{rsrcParams}{authParams}

  • - {genbHost} is the host where Genboree is running (e.g. www.genboree.org)
  • - {rsrcPath} is the path identifying the resource
    (e.g. /REST/v1/grp/{grpName}/db/{dbName}/tracks).
    • . This is like the path for a file on your computer; here, it is the path to get to a resource.
    • . The path points to a unique resource or a set of resources.
    • . It may not be the only path to that resource, however.
    • . Thus, the path provides some context to accessing the resource.
  • - {rsrcParams} are any parameters for the resource, generally to modify the representation received or sent.
  • - {authParams} are 3 required parameters Genboree uses to authorize and authenticate the user accessing/modifying the resource.

 

8.2.2. Uniform Methods [details]

How can you operate on a resource? You'd like to be able to retrieve resources, create new resources and change existing ones, and possibly be able to delete existing resources. These fundamental operations map well to the standard HTTP methods:

  • - GET to retrieve a representation of the resource.
  • - PUT a new resource or a change an existing resource.
  • - DELETE an existing resource.
  • - POST (currently unused, but reserved for appropriate ROA-founded extension)

(If this seems similar to the 'CRUD' of relational databases, that's not surprising. Databases store resources and 'CRUD' encapsulates almost anything you'd want to do to a stored resource.)

Methods have return values which communicate the result of operation on the resource—generally success or type of failure. As is standard for REST APIs, Genboree leverages the standard HTTP response codes for this purpose.

 

8.2.3. Resource Representations [details]

In general, each resource has an appropriate representation whose default syntax is JSON. Genboree makes use of a standard wrapper for all JSON representations, to allow communication of the actual data and also of status information (mainly useful for troubleshooting). The status information supplements the aforementioned response code return values.

Some resources share representations, although many have specific representations.

 

8.2.4. Authorization [details]

Genboree must authenticate the identity of the person accessing/modifying the resource via the API, just as it requires login on its web site. Furthermore, Genboree must verify that they are authorized to retrieve or change the resource. To do this, ALL resource URIs must be appended with 3 parameters containing authorization information:

  1. gbLogin the Genboree user name.
  2. gbTime the current POSIX time (a.k.a. epoch time or UNX time)
  3. gbToken computed as:
    SHA1({rsrcURI} + SHA1({gbLogin} + {userPassword}) + {gbTime})

 

 

 


Bioinformatics Research Laboratory
Genboree is a hosted service, but code is available free for academic use.
HGSC
© 2001-2024 Bioinformatics Research Laboratory
    (400D Jewish Wing, MS:BCM225, 1 Baylor Plaza, Houston, TX 77030, 713-798-5433)
Questions or comments?
Genboree Community Support Site