-
Piotr Gawron authoredPiotr Gawron authored
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 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/
Specification
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 with403
status code will be returned. Token will be valid for the next 120 minutes. - Example:
- URL:
curl -X POST -c - --data "login=anonymous&password=" http://pg-sandbox.uni.lu/minerva/api/doLogin
- Logout:
- URL:
/doLogout
- Method: POST
- Parameters: NONE
- Example:
- URL:
curl -X POST -c - http://pg-sandbox.uni.lu/minerva/api/doLogout
Configuration
- URL:
/configuration/
- Method: GET
- 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
- Parameters:
-
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
- Parameters:
-
projectId
- identifier of the project
-
- Parameters:
- Example:
- URL:
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
- Parameters:
*
projectId
- identifier of the project - Example:
- URL:
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:
- URL:
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)
- URL:
/projects/{projectId}/models/{modelId}:downloadModel
- Method: GET
- 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. *polygonString
(*) - polygon defining part of the model for downloading - See also
/configuration/
query to get list of possible formats - Example:
- URL:
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
- 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:
- URL:
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
- Elements:
- URL:
/projects/{projectId}/models/{modelId}/bioEntities/elements/
- Method: GET
- Parameters:
*
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:
- URL:
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:
-
projectId
- identifier of the project-
modelId
- identifier of the (sub)map in the project or wildcard '*' character
-
-
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:
- URL:
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
- Parameters:
-
projectId
- identifier of the project -
modelId
- identifier of the (sub)map in the project or wildcard '*' character -
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:
- URL:
curl -X GET --cookie "MINERVA_AUTH_TOKEN=xxxxxxxx" http://pg-sandbox.uni.lu/minerva/api/projects/pdmap_dec15/models/*/bioEntities:search?query=SNCA