Skip to content
Snippets Groups Projects
README.md 23.6 KiB
Newer Older
[![build status](https://git-r3lab.uni.lu/piotr.gawron/minerva/badges/master/build.svg)](https://git-r3lab.uni.lu/piotr.gawron/minerva/commits/master)
Piotr Gawron's avatar
Piotr Gawron committed

# Rest API (version 11)

## Introduction

Rest API is located in /api/ path of the deployed application. For instance, Rest API of pdmap project that can be browsed using http://pdmap.uni.lu/minerva/ will be located here: http://pdmap.uni.lu/minerva/api/

Rest API tries to follow [API Design Guide](https://cloud.google.com/apis/design/) by Google.

All API calls (except login) must include MINERVA_AUTH_TOKEN obtained due login process.

## Quickstart guide

To use API first we need to login:
`curl -X POST -c - --data "login=anonymous&password=" http://pg-sandbox.uni.lu/minerva/api/doLogin`

```
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    55    0    55    0     0   1774      0 --:--:-- --:--:-- --:--:--  1774{"info":"Login successful. TOKEN returned as a cookie"}# Netscape HTTP Cookie File
# https://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.

localhost       FALSE   /       FALSE   1496934071      MINERVA_AUTH_TOKEN      xxxxxxxx
```
The response creates an authentication token and puts it into a cookie `MINERVA_AUTH_TOKEN=xxxxxxxx`. When using console curl command this cookie must be attached to every query that follows.
When we have authentication token we can access information about december release of PD map project:
`
curl -X GET --cookie "MINERVA_AUTH_TOKEN=xxxxxxxx" http://pg-sandbox.uni.lu/minerva/api/projects/pdmap_dec15/
`

### Authentication
* Login:
    * URL: `/doLogin`
    * Method: POST
    * Parameters:
      * `login` - user login, 'anonymous' can be used for accessing api with guest account access level
      * `password` - user passwod, for guest account this field is optional 
    * Output. If login operation is successfull then `MINERVA_AUTH_TOKEN` cookie will be created with authentication token. If credentails are invalid response with `403` status code will be returned. Token will be valid for the next 120 minutes.
    * Example: 
```
curl -X POST -c - --data "login=anonymous&password=" http://pg-sandbox.uni.lu/minerva/api/doLogin
```

Piotr Gawron's avatar
Piotr Gawron committed
* Logout:
    * URL: `/doLogout`
    * Method: POST
Piotr Gawron's avatar
Piotr Gawron committed
		* Parameters: *NONE*
    * Example: 
```
curl -X POST -c - http://pg-sandbox.uni.lu/minerva/api/doLogout
```
		

### Configuration
* URL: `/configuration/`
* Method: GET
Piotr Gawron's avatar
Piotr Gawron committed
* Parameters: *NONE*
* Output: List of all minerva configuration details.
* Example:
```
curl -X GET --cookie "MINERVA_AUTH_TOKEN=xxxxxxxx" http://pg-sandbox.uni.lu/minerva/api/configuration/
```

### Genomics    
* URL: `/genomics/taxonomies/{organismId}/genomeTypes/{type}/versions/{version}/`
* Method: GET
Piotr Gawron's avatar
Piotr Gawron committed
* Parameters:
Piotr Gawron's avatar
Piotr Gawron committed
  * `organismId` - identifier of the organism in taxonomy db
  * `type` - type of genome (database from which reference genome should be used), for now only UCSC is supported
  * `version` - version of the reference genome 
* Example:
```
curl -X GET --cookie "MINERVA_AUTH_TOKEN=xxxxxxxx" http://pg-sandbox.uni.lu/minerva/api/genomics/taxonomies/9606/genomeTypes/UCSC/versions/hg19/
### Projects

* Project data:
  * URL: `/projects/{projectId}/`
  * Method: GET
Piotr Gawron's avatar
Piotr Gawron committed
	* Parameters: 
Piotr Gawron's avatar
Piotr Gawron committed
		* `projectId` - identifier of the project
  * Example:
```
curl -X GET --cookie "MINERVA_AUTH_TOKEN=xxxxxxxx" http://pg-sandbox.uni.lu/minerva/api/projects/pdmap_dec15/
```

* Source file:
  * URL: `/projects/{projectId}:downloadSource`
  * Method: GET
Piotr Gawron's avatar
Piotr Gawron committed
  * Parameters:
Piotr Gawron's avatar
Piotr Gawron committed
		* `projectId` - identifier of the project
  * Example:
```
curl -X GET --cookie "MINERVA_AUTH_TOKEN=xxxxxxxx" http://pg-sandbox.uni.lu/minerva/api/projects/pdmap_jun16:downloadSource --output some.file
```	

#### (sub)Maps
* List of (sub)maps in a project
  * URL: `/projects/{projectId}/models/`
  * Method: GET
  * Parameters:  
		* `projectId` - identifier of the project
  * Example:
```
curl -X GET --cookie "MINERVA_AUTH_TOKEN=xxxxxxxx" "http://pg-sandbox.uni.lu/minerva/api/projects/pdmap_dec15/models/"
```	

* Download map as a model file (ie. in CellDesigner format)
Piotr Gawron's avatar
Piotr Gawron committed
  * URL: `/projects/{projectId}/models/{modelId}:downloadModel`
  * Method: GET
Piotr Gawron's avatar
Piotr Gawron committed
  * Parameters:  
		* `projectId` - identifier of the project
		* `modelId` - identifier of the (sub)map in the project
		* `handlerClass` - class preparing model file. For list of all possible values check `/configuration/` response.
Piotr Gawron's avatar
Piotr Gawron committed
		* `polygonString` (\*) - polygon defining part of the model for downloading
  * See also `/configuration/` query to get list of possible formats
  * Example:
```
curl -X GET --cookie "MINERVA_AUTH_TOKEN=xxxxxxxx" "http://pg-sandbox.uni.lu/minerva/api/projects/pdmap_dec15/models/15305:downloadModel?handlerClass=lcsb.mapviewer.converter.model.celldesigner.CellDesignerXmlParser" --output some.file
```	

* Download map as an image
	* URL: `/projects/{projectId}/models/{modelId}:downloadImage`
  * Method: GET
Piotr Gawron's avatar
Piotr Gawron committed
  * Parameters: 
		* `projectId` - identifier of the project
		* `modelId` - identifier of the (sub)map in the project
		* `handlerClass` - class preparing image file. For list of all possible values check `/configuration/` response.
		* `backgroundOverlayId` (\*) - identifier of the overlay used as a background overlay when creating image
		* `overlayIds` (\*) - comma separated list of overlay identifiers that should be included in the image
		* `zoomLevel` (\*) - zoom level at which image should be generated (min value used by default)
		* `polygonString` (\*) - polygon defining part of the model for downloading
  * See also `/configuration/` query to get list of possible formats
  * Example:
```
curl -X GET --cookie "MINERVA_AUTH_TOKEN=xxxxxxxx" "http://pg-sandbox.uni.lu/minerva/api/projects/pdmap_dec15/models/15305:downloadImage?handlerClass=lcsb.mapviewer.converter.graphics.PngImageGenerator" --output some.file
  * URL: `/projects/{projectId}/models/{modelId}/bioEntities/elements/`
  * Method: GET
  * Parameters:
Piotr Gawron's avatar
Piotr Gawron committed
		* `projectId` - identifier of the project
		* `modelId` - identifier of the (sub)map in the project or wildcard '*' character 
		* `columns` (\*) - set of columns (optional). Possible values are: id, modelId, name, type, description, symbol, complexId, compartmentId, fullName, abbreviation, formula, name, synonyms, formerSymbols, references, bounds, hierarchyVisibilityLevel,
		* `ids`  (\*)- set of database ids (optional) 
  * Example:
```
curl -X GET --cookie "MINERVA_AUTH_TOKEN=xxxxxxxx" http://pg-sandbox.uni.lu/minerva/api/projects/pdmap_dec15/models/*/bioEntities/elements/?columns=id,name,type
* Reactions:
  * URL: `/projects/{projectId}/models/{modelId}/bioEntities/reactions/`
  * Method: GET
  * Parameters:
Piotr Gawron's avatar
Piotr Gawron committed
    * `projectId` - identifier of the project
Piotr Gawron's avatar
Piotr Gawron committed
		* `modelId` - identifier of the (sub)map in the project or wildcard '*' character 
Piotr Gawron's avatar
Piotr Gawron committed
    * `columns` (\*) - set of columns. Possible values are: id, reactionId, modelId, type, lines, centerPoint, products, reactants, modifiers, hierarchyVisibilityLevel, notes
    * `ids` (\*) - set of database ids 
    * `participantId` (\*) - identifier of the element that should be part of the reaction   
  * Example:
```
curl -X GET --cookie "MINERVA_AUTH_TOKEN=xxxxxxxx" http://pg-sandbox.uni.lu/minerva/api/projects/pdmap_dec15/models/*/bioEntities/reactions/?columns=id,name,type
```    

* Search:
	* URL:	`/projects/{projectId}/models/{modelId}/bioEntities:search` 
	* Method: GET
Piotr Gawron's avatar
Piotr Gawron committed
	* Parameters:
		* `projectId` - identifier of the project
Piotr Gawron's avatar
Piotr Gawron committed
		* `modelId` - identifier of the (sub)map in the project or wildcard '*' character 
Piotr Gawron's avatar
Piotr Gawron committed
		* `query` (\*) - search term identifing bioEntity 
		* `coordinates` (\*) - coordinates where bioEntity should be located
		* `count` (\*) - max number of bioEntities to return
		* `perfectMatch` (\*) - true when true query must be matched exactly, if false similar results are also acceptable
	* Example:
```
curl -X GET --cookie "MINERVA_AUTH_TOKEN=xxxxxxxx" http://pg-sandbox.uni.lu/minerva/api/projects/pdmap_dec15/models/*/bioEntities:search?query=SNCA
```    

* Suggested search queries:
	* URL:	`/projects/{projectId}/models/{modelId}/bioEntities/suggestedQueryList` 
	* Method: GET
Piotr Gawron's avatar
Piotr Gawron committed
	* Output: List of suggested queries for search mechanism.
	* Parameters:
		* `projectId` - identifier of the project
	* Example:
```
curl -X GET --cookie "MINERVA_AUTH_TOKEN=xxxxxxxx" http://pg-sandbox.uni.lu/minerva/api/projects/pdmap_dec15/models/*/bioEntities/suggestedQueryList
```    


#### Chemicals
* URL:	`/projects/{projectId}/chemicals:search` 
* Method: GET
Piotr Gawron's avatar
Piotr Gawron committed
* Parameters:
	* `projectId` - identifier of the project
  * `columns` (\*) - set of columns for each result. Possible values are: name, references, description, directEvidenceReferences, directEvidence, synonyms, id, targets, 
  * `query` (\*) - chemical name
  * `target` (\*) - target for which we are lookig for chemicals. Target is defined as TYPE:ID. For example "ALIAS:534" is searching for chemicals that target Alias with id=534. 
* Example:
```
curl -X GET --cookie "MINERVA_AUTH_TOKEN=xxxxxxxx" "http://pg-sandbox.uni.lu/minerva/api/projects/pdmap_dec15/chemicals:search?query=rotenone"
```    

#### Comments    
* List comments
	* URL:	`/projects/{projectId}/comments/models/{modelId}/` 
	* Method: GET
Piotr Gawron's avatar
Piotr Gawron committed
	* Parameters: 
		* `projectId` - identifier of the project
Piotr Gawron's avatar
Piotr Gawron committed
		* `modelId` - identifier of the (sub)map in the project or wildcard '*' character 
Piotr Gawron's avatar
Piotr Gawron committed
	  * `columns` (\*) - set of columns for each result. Possible values are: title, type, content, removed, coord, modelId, elementId, id, pinned, author, email, 
	  * `removed` (\*) - if defined then removed paramter must match.
	* Example:
```
curl -X GET --cookie "MINERVA_AUTH_TOKEN=xxxxxxxx" "http://pg-sandbox.uni.lu/minerva/api/projects/pdmap_dec15/comments/models/*/"
```    
    
* Reaction comments
	* URL:	`/projects/{projectId}/comments/models/{modelId}/bioEntities/reactions/{reactionId}` 
	* Method: GET
Piotr Gawron's avatar
Piotr Gawron committed
	* Parameters:
		* `projectId` - identifier of the project
Piotr Gawron's avatar
Piotr Gawron committed
		* `modelId` - identifier of the (sub)map in the project or wildcard '*' character 
Piotr Gawron's avatar
Piotr Gawron committed
		* `reactionId` - identifier of the reaction
	  * `columns` (\*) - set of columns for each result. Possible values are: title, type, content, removed, coord, modelId, elementId, id, pinned, author, email, 
	  * `removed` (\*) - if defined then removed paramter must match.
	* Example:
```
curl -X GET --cookie "MINERVA_AUTH_TOKEN=xxxxxxxx" http://pg-sandbox.uni.lu/minerva/api/projects/pdmap_dec15/comments/models/15305/bioEntities/reactions/187811/
```    

* Element comments    
	* URL:	`/projects/{projectId}/comments/models/{modelId}/bioEntities/elements/{elementId}` 
	* Method: GET
Piotr Gawron's avatar
Piotr Gawron committed
	* Parameters: 
		* `projectId` - identifier of the project
Piotr Gawron's avatar
Piotr Gawron committed
		* `modelId` - identifier of the (sub)map in the project or wildcard '*' character 
Piotr Gawron's avatar
Piotr Gawron committed
		* `elementId` - identifier of the element
	  * `columns` (\*) - set of columns for each result. Possible values are: title, type, content, removed, coord, modelId, elementId, id, pinned, author, email, 
	  * `removed` (\*) - if defined then removed paramter must match.
	* Example:
```
curl -X GET --cookie "MINERVA_AUTH_TOKEN=xxxxxxxx" http://pg-sandbox.uni.lu/minerva/api/projects/pdmap_dec15/comments/models/15305/bioEntities/elements/431868/
```    

* Point comments
	* URL:	`/projects/{projectId}/comments/models/{modelId}/points/{coordinates}` 
	* Method: GET
Piotr Gawron's avatar
Piotr Gawron committed
	* Parameters:
		* `projectId` - identifier of the project
Piotr Gawron's avatar
Piotr Gawron committed
        * `modelId` - identifier of the (sub)map in the project or wildcard '*' character 
Piotr Gawron's avatar
Piotr Gawron committed
		* `coordinates` - coordinates of the point on (sub)map
Piotr Gawron's avatar
Piotr Gawron committed
		* `columns` (\*) - set of columns for each result. Possible values are: title, type, content, removed, coord, modelId, elementId, id, pinned, author, email, 
		* `removed` (\*) - if defined then removed paramter must match.
	* Example: TODO

* Create element comment 
	* URL:	`/projects/{projectId}/comments/models/{modelId}/bioEntities/elements/{elementId}` 
	* Method: POST
Piotr Gawron's avatar
Piotr Gawron committed
	* Parameters: 
		* `projectId` - identifier of the project
Piotr Gawron's avatar
Piotr Gawron committed
		* `modelId` - identifier of the (sub)map in the project 
Piotr Gawron's avatar
Piotr Gawron committed
		* `elementId` - identifier of the element to be commented 
		* `name` - name of the author
		* `email` - email of the author
		* `content` - content of the comment
		* `pinned` (\*) - when true comment will be visible for others, if false then nobody except of admin will see it  
		* `coordinates` - coordinates where comment is placed
	* Example:
```
curl -X POST --cookie "MINERVA_AUTH_TOKEN=xxxxxxxx" --data "name=testComment&email=a@a.pl&content=someCont&coordinates=1,2" http://pg-sandbox.uni.lu/minerva/api/projects/pdmap_dec15/comments/models/15305/bioEntities/elements/431868/
```    

* Create reaction comment
	* URL:	`/projects/{projectId}/comments/models/{modelId}/bioEntities/reactions/{reactionId}` 
	* Method: POST
Piotr Gawron's avatar
Piotr Gawron committed
	* Parameters: 
		* `projectId` - identifier of the project
Piotr Gawron's avatar
Piotr Gawron committed
		* `modelId` - identifier of the (sub)map in the project 
Piotr Gawron's avatar
Piotr Gawron committed
		* `reactionId` - identifier of the reaction
		* `name` - name of the author
		* `email` - email of the author
		* `content` - content of the comment
		* `pinned` (\*) - when true comment will be visible for others, if false then nobody except of admin will see it  
		* `coordinates` - coordinates where comment is placed
	* Example:
```
curl -X POST --cookie "MINERVA_AUTH_TOKEN=xxxxxxxx" --data "name=testComment&email=a@a.pl&content=someCont&coordinates=1,2" http://pg-sandbox.uni.lu/minerva/api/projects/pdmap_dec15/comments/models/15305/bioEntities/reactions/187811
```    

    
* Create coordinates comment
	* URL:	`/projects/{projectId}/comments/models/{modelId}/points/{coordinates}` 
	* Method: GET
Piotr Gawron's avatar
Piotr Gawron committed
	* Parameters:
		* `projectId` - identifier of the project
Piotr Gawron's avatar
Piotr Gawron committed
		* `modelId` - identifier of the (sub)map in the project 
Piotr Gawron's avatar
Piotr Gawron committed
		* `name` - name of the author
		* `email` - email of the author
		* `content` - content of the comment
		* `pinned` (\*) - when true comment will be visible for others, if false then nobody except of admin will see it  
		* `coordinates` - coordinates where comment is placed
	* Example:
```
curl -X POST --cookie "MINERVA_AUTH_TOKEN=xxxxxxxx" --data "name=testComment&email=a@a.pl&content=someCont" http://pg-sandbox.uni.lu/minerva/api/projects/pdmap_dec15/comments/models/15305/points/1.00,2.00
```    

#### Drugs
* URL:	`/projects/{projectId}/drugs:search` 
* Method: GET
Piotr Gawron's avatar
Piotr Gawron committed
* Parameters:
Piotr Gawron's avatar
Piotr Gawron committed
    * `projectId` - identifier of the project
    * `columns` (\*) - set of columns for each result. Possible values are: name, references, description, bloodBrainBarrier, brandNames, synonyms, id, targets, 
    * `query` (\*) - drug name or synonym
    * `target` (\*) - target for which we are lookig for drugs. Target is defined as TYPE:ID. For example "ALIAS:534" is searching for drugs that target Alias with id=534. 
* Example:
```
curl -X GET --cookie "MINERVA_AUTH_TOKEN=xxxxxxxx" http://pg-sandbox.uni.lu/minerva/api/projects/pdmap_dec15/drugs:search?query=aspirin
```    

#### MiRNAs
   
* URL:	`/projects/{projectId}/miRnas:search` 
* Method: GET
Piotr Gawron's avatar
Piotr Gawron committed
* Parameters: 
Piotr Gawron's avatar
Piotr Gawron committed
    * `projectId` - identifier of the project
    * `columns` (\*) - set of columns for each result. Possible values are: name, id, targets, 
    * `query` (\*) - mirna id
    * `target` (\*) - target for which we are lookig for drugs. Target is defined as TYPE:ID. For example "ALIAS:534" is searching for drugs that target Alias with id=534. 
* Example:
```
curl -X GET --cookie "MINERVA_AUTH_TOKEN=xxxxxxxx" http://pg-sandbox.uni.lu/minerva/api/projects/pdmap_dec15/miRnas:search?query=hsa-miR-125a-3p
```    

    
#### Publications
    
* URL:	`/projects/{projectId}/models/{modelId}/publications/` 
* Method: GET
Piotr Gawron's avatar
Piotr Gawron committed
* Parameters: 
	* `projectId` - identifier of the project
Piotr Gawron's avatar
Piotr Gawron committed
    * `modelId` - identifier of the (sub)map in the project or wildcard '\*' character 
Piotr Gawron's avatar
Piotr Gawron committed
	* `start` (\*) - first element to be return when pagination is on (default 0)
	* `length` (\*) - how many publication we want to retrieve (default 10)
	
* Example:
```
curl -X GET --cookie "MINERVA_AUTH_TOKEN=xxxxxxxx" http://pg-sandbox.uni.lu/minerva/api/projects/pdmap_dec15/models/*/publications/
```    

#### Data overlays
* List user data overlays
	* URL:	`/projects/{projectId}/overlays/` 
	* Method: GET
Piotr Gawron's avatar
Piotr Gawron committed
	* Parameters: 
		* `projectId` - identifier of the project
	* Example:
```
curl -X GET --cookie "MINERVA_AUTH_TOKEN=xxxxxxxx" http://pg-sandbox.uni.lu/minerva/api/projects/pdmap_dec15/overlays/
Piotr Gawron's avatar
Piotr Gawron committed
* Add overlay    
	* URL:	`/projects/{projectId}/overlays/` 
	* Method: POST
	* Parameters: 
Piotr Gawron's avatar
Piotr Gawron committed
		* `projectId` - identifier of the project
Piotr Gawron's avatar
Piotr Gawron committed
		* `name` - name of the data overlay
		* `content` - content of the file that is uploaded with definition what should be visible where
		* `description` - short desription of the data overlay
		* `filename` - name of the file that should be used when downloading the source
	* Example:
```
Piotr Gawron's avatar
Piotr Gawron committed
curl -X POST --data "content=name%09color%0ACAPN1%09%2300FF00%0APARK7%09%23AC0000&description=test%20desc&filename=test.txt&name=test%20nam" --cookie "MINERVA_AUTH_TOKEN=xxxxxxxx" http://pg-sandbox.uni.lu/minerva/api/projects/pdmap_dec15/overlays/
Piotr Gawron's avatar
Piotr Gawron committed
* Update overlay    
	* URL:	`/projects/{projectId}/overlays/{overlayId}/` 
	* Method: PATCH
Piotr Gawron's avatar
Piotr Gawron committed
	* Parameters:
		* `projectId` - identifier of the project
		* `overlayId` - identifier of data overlay
	* Body: json with updated overlay
Piotr Gawron's avatar
Piotr Gawron committed

{
  "overlay": {
    "name" : name, 
    "description" : description
  } 
}

	* Example:
```
Piotr Gawron's avatar
Piotr Gawron committed
curl -X PATCH --data "{\"overlay\":{\"name\":\"test\", \"description\":\"test2\"}}" --cookie "MINERVA_AUTH_TOKEN=xxxxxxxx" http://pg-sandbox.uni.lu/minerva/api/projects/pdmap_dec15/overlays/3203/
Piotr Gawron's avatar
Piotr Gawron committed
    
* Remove overlay    
	* URL:	`/projects/{projectId}/overlays/{overlayId}/` 
	* Method: DELETE
Piotr Gawron's avatar
Piotr Gawron committed
	* Parameters: 
		* `projectId` - identifier of the project
		* `overlayId` - identifier of data overlay
	* Example:
```
Piotr Gawron's avatar
Piotr Gawron committed
curl -X DELETE --cookie "MINERVA_AUTH_TOKEN=xxxxxxxx" http://pg-sandbox.uni.lu/minerva/api/projects/pdmap_dec15/overlays/3203/
Piotr Gawron's avatar
Piotr Gawron committed
* Download source    
	* URL:	`/projects/{projectId}/overlays/{overlayId}:downloadSource` 
	* Method: GET
Piotr Gawron's avatar
Piotr Gawron committed
	* Parameters:
		* `projectId` - identifier of the project
		* `overlayId` - identifier of data overlay
	* Example:
```
Piotr Gawron's avatar
Piotr Gawron committed
curl -X GET --cookie "MINERVA_AUTH_TOKEN=xxxxxxxx" http://pg-sandbox.uni.lu/minerva/api/projects/pdmap_dec15/overlays/3203:downloadSource
```
Piotr Gawron's avatar
Piotr Gawron committed
* Data overlay details
Piotr Gawron's avatar
Piotr Gawron committed
	* URL:	`/projects/{projectId}/overlays/{overlayId}/` 
Piotr Gawron's avatar
Piotr Gawron committed
	* Method: GET
Piotr Gawron's avatar
Piotr Gawron committed
	* Parameters:
		* `projectId` - identifier of the project
		* `overlayId` - identifier of data overlay
	* Example:
```
Piotr Gawron's avatar
Piotr Gawron committed
curl -X GET --cookie "MINERVA_AUTH_TOKEN=xxxxxxxx" http://pg-sandbox.uni.lu/minerva/api/projects/pdmap_dec15/overlays/3203/
Piotr Gawron's avatar
Piotr Gawron committed
* bioEntities (Elements and reactions)
	* URL:	`/projects/{projectId}/overlays/{overlayId}/models/{modelId}/bioEntities/` 
	* Method: GET
Piotr Gawron's avatar
Piotr Gawron committed
	* Parameters:
		* `projectId` - identifier of the project
		* `overlayId` - identifier of data overlay
	* Example:
```
Piotr Gawron's avatar
Piotr Gawron committed
curl -X GET --cookie "MINERVA_AUTH_TOKEN=xxxxxxxx" http://pg-sandbox.uni.lu/minerva/api/projects/pdmap_dec15/overlays/3203/models/*/bioEntities/
Piotr Gawron's avatar
Piotr Gawron committed
* Reaction
	* URL:	`/projects/{projectId}/overlays/{overlayId}/models/{modelId}/bioEntities/reactions/{reactionId}/` 
	* Method: GET
Piotr Gawron's avatar
Piotr Gawron committed
	* Parameters:
		* `projectId` - identifier of the project
Piotr Gawron's avatar
Piotr Gawron committed
		* `modelId` - identifier of the (sub)map in the project 
Piotr Gawron's avatar
Piotr Gawron committed
		* `overlayId` - identifier of data overlay
		* `reactionId` - identifier of the reaction
	* Example:
```
Piotr Gawron's avatar
Piotr Gawron committed
curl -X GET --cookie "MINERVA_AUTH_TOKEN=xxxxxxxx" http://pg-sandbox.uni.lu/minerva/api/projects/pdmap_dec15/overlays/3203/models/15305/bioEntities/reactions/187811/
```    
Piotr Gawron's avatar
Piotr Gawron committed
* Element
	* URL:	`/projects/{projectId}/overlays/{overlayId}/models/{modelId}/bioEntities/elements/{elementId}/` 
	* Method: GET
Piotr Gawron's avatar
Piotr Gawron committed
	* Parameters:
		* `projectId` - identifier of the project
Piotr Gawron's avatar
Piotr Gawron committed
		* `modelId` - identifier of the (sub)map in the project 
Piotr Gawron's avatar
Piotr Gawron committed
		* `overlayId` - identifier of data overlay
		* `elementId` - identifier of the element
	* Example:
```
Piotr Gawron's avatar
Piotr Gawron committed
curl -X GET --cookie "MINERVA_AUTH_TOKEN=xxxxxxxx" http://pg-sandbox.uni.lu/minerva/api/projects/pdmap_dec15/overlays/3203/models/15305/bioEntities/elements/431433/
Piotr Gawron's avatar
Piotr Gawron committed

* User data		 
	* URL:	`/users/{login}/` 
	* Method: GET
Piotr Gawron's avatar
Piotr Gawron committed
	* Parameters: 
		* `login` - user login
	* Example:
```
curl -X GET --cookie "MINERVA_AUTH_TOKEN=xxxxxxxx" http://pg-sandbox.uni.lu/minerva/api/users/testAdmin
Piotr Gawron's avatar
Piotr Gawron committed
# JavaScript API. Unstable dev API.

Minerva visualization is created by including `minerva.js` and calling `minerva.create({element:divElement})` method. This method returns a Promise which will resolve to the object that allows custom JS manipulation.

## Specification

* `getVisibleDataOverlays()` 
	* Description: Returns a Promise with list of visible overlays
Piotr Gawron's avatar
Piotr Gawron committed
	* Arguments: *NONE*
	* Example:
```
customMap.getVisibleDataOverlays().then(function(overlays){console.log(overlays);});
```
*	`addListener({dbOverlayName, type, callback})`
	* Description: Adds a listener to database connector like drug database.
	* Arguments: 
		* dbOverlayName - string representing database for which we want to register listener, available databases are: `search`, `drug`, `chemical`, `mirna`, `comment`
		* type - type of the event, supported db Events are: `onSearch`
		* callback - callback method
	* Example
```
customMap.addListener({dbOverlayName:"search",type:"onSearch", callback:function(res){console.log(res);}});
```
* `getHighlightedBioEntities(dbOverlayName)`
  * Description: returns a promise with list of elements that are currently highlight by the specufuc database 
	* Arguments: dbOverlayName - string representing database for which we want to register listener, available databases are: `search`, `drug`, `chemical`, `mirna`, `comment`
	* Example:
```
customMap.getHighlightedBioEntities("search").then(function(elements){console.log(elements);});
```
* `getProject()`
  * Description: Returns object with information about visualized disease map project.
	* Arguments: NONE
	* Example:
```
customMap.getProject()
```
* `getConfiguration()`
  * Description: Returns a promise with configuration information obtained from server. Configuration information include configuration options (like default visible map), supported formats, etc. 
	* Arguments: NONE
	* Example: 
```
customMap.getConfiguration().then(function(configuration){console.log(configuration);});
```
* `getAllBioEntities()`
	* Arguments: NONE
	* Example:
```
customMap.getAllBioEntities().then(function(bioEntities){console.log(bioEntities);});
```
* `getBioEntityById({id, modelId, type})`
	* Arguments: TODO
	* Example:
```
TODO
```
	
* `getReactionsWithElement(element)`
	* Arguments: TODO
	* Example:
```
TODO
```
	
* `showBioEntity({element, type, options})`
Piotr Gawron's avatar
Piotr Gawron committed
	* Arguments:
		* element - object identifying the element, it should contain three fields: id, type, model; where id is the element id, type is type of the element ('ALIAS', 'REACTION'), and model define submap on which it's defined
Piotr Gawron's avatar
Piotr Gawron committed
		* type - how do you want to visualize BioEntity: 'ICON', 'SURFACE'
		* options - set of visualization options: color, opacity, lineColor, lineWeight, lineOpacity
Piotr Gawron's avatar
Piotr Gawron committed
	* Example:	
Piotr Gawron's avatar
Piotr Gawron committed
customMap.showBioEntity({element:{id:18306,type:"ALIAS", modelId:5}, type: "SURFACE", options:{color:"#FF0000"}});
```
	
* `hideBioEntity({element, type})`
Piotr Gawron's avatar
Piotr Gawron committed
	* Arguments:
		* element - object identifying the element, it should contain three fields: id, type, model; where id is the element id, type is type of the element ('ALIAS', 'REACTION'), and model define submap on which it's defined
		* type - which visualization of BioEntity you want to hide: 'ICON', 'SURFACE' 
	* Example:
```
Piotr Gawron's avatar
Piotr Gawron committed
customMap.hideBioEntity({element:{id:18306,type:"ALIAS", modelId:5}, type: "SURFACE"});
```
	
* `setCenter({modelId, x, y})`
	* Arguments: TODO
	* Example:
```
TODO
```
	
* `fitBounds({modelId, x1, y1, x2, y2})`
	* Arguments: TODO
	* Example:
```
TODO
```
	
* `setCenter({modelId, x, y})`
	* Arguments: TODO
	* Example:
```
TODO
```