API¶
The EDAMmap API is consumed by sending a JSON request with HTTP POST. The main endpoint is /api, which on the public instance translates to https://biit.cs.ut.ee/edammap/api.
JSON numbers and booleans are converted to strings internally. JSON objects are ignored (except under bio.tools input), meaning there is no hierarchy in the request JSON structure.
/api¶
The main endpoint is used for performing one mapping. The key-value pairs in the request JSON fall under two categories: query data and parameters.
Query data¶
The query data to be mapped can be supplied in two different ways: as strings or arrays of strings under field names mirroring the usual EDAMmap input names or as a bio.tools input JSON object (like a bio.tools entry in JSON format). In case data is specified using both ways, only data under the bio.tools input is used.
EDAMmap input¶
The following data can be given, with only the “name” being mandatory.
Key | Type | Description |
---|---|---|
name | string | Name of tool or service |
keywords | array of strings | Keywords, tags, etc |
description | string | Short description of tool or service |
webpageUrls | array of strings | URLs of homepage, etc |
docUrls | array of strings | URLs of documentations |
publicationIds | array of strings/objects | PMID/PMCID/DOI of journal article Note: an article ID can be specified as a string |
annotations | array of strings | Existing annotations from EDAM |
bio.tools input¶
Under the field name “tool”, a JSON object adhering to biotoolsSchema can be specified. All values possible in bio.tools can be specified, but only values relevant to EDAMmap will be used. A few attributes are mandatory: name, description and homepage. The input will be mirrored under tool in the response, but with found EDAM terms added to it.
Parameters¶
Main¶
Parameter | Default | Description |
---|---|---|
version | "1" |
API version. Currently, only one possible value: "1" . |
type | "core" |
Detail level of the response. Possible values: "core" , "full" . |
txt | false |
Also output results to plain text file. The location of the created file can be read from the response. |
html | false |
Also output results to HTML file. The location of the created file can be read from the response. |
Preprocessing¶
Parameter | Default | Min | Description |
---|---|---|---|
numbers | true |
Include/exclude freestanding numbers (i.e., that are not part of a word) in pre-processing | |
stopwords | "lucene" |
Do stopwords removal as part of pre-processing, using the chosen stopwords list. Possible values: "off" , "corenlp" , "lucene" , "mallet" , "smart" , "snowball" . |
|
stemming | true |
Do stemming as part of pre-processing | |
minLength | 1 |
0 |
When all pre-processing steps are done, tokens with length less to this length are removed |
Fetching¶
The fetching parameters are implemented in PubFetcher and thus are described in its documentation: Fetching parameters.
Mapping¶
Parameter | Default | Min | Max | Description |
---|---|---|---|---|
branches | ["topic", "operation"] |
Branches to include. Can choose multiple at once from possible values: "topic" , "operation" , "data" , "format" . |
||
matches | 5 |
0 |
Number of best matches per branch to output. Output amount can be less than requested if not enough match final scores fulfill score limits requirement. | |
obsolete | false |
Include matched obsolete concepts | ||
replaceObsolete | true |
Replace matched obsolete concepts with their best matched replacement defined in EDAM (with “replacedBy” or “consider”) | ||
obsoletePenalty | 0.5 |
0.0 |
1.0 |
The fraction of the final score that included or replaced obsolete concepts will get |
doneAnnotations | true |
Suggest concepts already used for annotating query. Parents and children of these concepts are not suggested in any case (unless inferiorParentsChildren is set to true ). |
||
inferiorParentsChildren | false |
Include parents and children of a better matched concept in suggestion results |
Mapping algorithm¶
Parameter | Default | Min | Max | Description |
---|---|---|---|---|
compoundWords | 1 |
0 |
Try to match words that have accidentally been made compound (given number is maximum number of words in an accidental compound minus one). Not done for tokens from fulltext, doc and webpage. Set to 0 to disable (for a slight speed increase with only slight changes to the results). | |
mismatchMultiplier | 2.0 |
0.0 |
Multiplier for score decrease caused by mismatch | |
matchMinimum | 1.0 |
0.0 |
1.0 |
Minimum score allowed for approximate match. Not done for tokens from fulltext, doc and webpage. Set to 1 to disable approximate matching. |
positionOffBy1 | 0.35 |
0.0 |
1.0 |
Multiplier of a position score component for the case when a word is inserted between matched words or matched words are switched |
positionOffBy2 | 0.05 |
0.0 |
1.0 |
Multiplier of a position score component for the case when two words are inserted between matched words or matched words are switched with an additional word between them |
positionMatchScaling | 0.5 |
0.0 |
Set to 0 to not have match score of neighbor influence position score. Setting to 1 means linear influence. |
|
positionLoss | 0.4 |
0.0 |
1.0 |
Maximum loss caused by wrong positions of matched words |
scoreScaling | 0.2 |
0.0 |
Score is scaled before applying multiplier and weighting with other direction match. Setting to 0 or 1 means no scaling. |
|
conceptWeight | 1.0 |
0.0 |
Weight of matching a concept (with a query). Set to 0 to disable matching of concepts. |
|
queryWeight | 1.0 |
0.0 |
Weight of matching a query (with a concept). Set to 0 to disable matching of queries. |
|
mappingStrategy | "average" |
Choose the best or take the average of query parts matches. Possible value: "best" , "average" . |
||
parentWeight | 0.5 |
0.0 |
Weight of concept’s parent when computing path enrichment. Weight of grand-parent is parentWeight times parentWeight , etc. Set to 0 to disable path enrichment. |
|
pathWeight | 0.7 |
0.0 |
Weight of path enrichment. Weight of concept is 1 . Set to 0 to disable path enrichment. |
IDF¶
Parameter | Default | Min | Description |
---|---|---|---|
conceptIdfScaling | 0.5 |
0.0 |
Set to 0 to disable concept IDF. Setting to 1 means linear IDF weighting. |
queryIdfScaling | 0.5 |
0.0 |
Set to 0 to disable query IDF. Setting to 1 means linear IDF weighting. |
labelSynonymsIdf | false |
IDF weighting for concept label and synonyms | |
nameKeywordsIdf | true |
IDF weighting for query name and keywords | |
descriptionIdf | true |
IDF weighting for query description | |
titleKeywordsIdf | true |
IDF weighting for publication title and keywords | |
abstractIdf | true |
IDF weighting for publication abstract |
Concept multipliers¶
Parameter | Default | Min | Max | Description |
---|---|---|---|---|
labelMultiplier | 1.0 |
0.0 |
1.0 |
Score multiplier for matching a concept label. Set to 0 to disable matching of labels. |
exactSynonymMultiplier | 1.0 |
0.0 |
1.0 |
Score multiplier for matching a concept exact synonym. Set to 0 to disable matching of exact synonyms. |
narrowBroadSynonymMultiplier | 1.0 |
0.0 |
1.0 |
Score multiplier for matching a concept narrow or broad synonym. Set to 0 to disable matching of narrow and broad synonyms. |
definitionMultiplier | 1.0 |
0.0 |
1.0 |
Score multiplier for matching a concept definition. Set to 0 to disable matching of definitions. |
commentMultiplier | 1.0 |
0.0 |
1.0 |
Score multiplier for matching a concept comment. Set to 0 to disable matching of comments. |
Query normalisers¶
Parameter | Default | Min | Max | Description |
---|---|---|---|---|
nameNormaliser | 0.81 |
0.0 |
1.0 |
Score normaliser for matching a query name. Set to 0 to disable matching of names. |
keywordNormaliser | 0.77 |
0.0 |
1.0 |
Score normaliser for matching a query keyword. Set to 0 to disable matching of keywords. |
descriptionNormaliser | 0.92 |
0.0 |
1.0 |
Score normaliser for matching a query description. Set to 0 to disable matching of descriptions. |
publicationTitleNormaliser | 0.91 |
0.0 |
1.0 |
Score normaliser for matching a publication title. Set to 0 to disable matching of titles. |
publicationKeywordNormaliser | 0.77 |
0.0 |
1.0 |
Score normaliser for matching a publication keyword. Set to 0 to disable matching of keywords. |
publicationMeshNormaliser | 0.75 |
0.0 |
1.0 |
Score normaliser for matching a publication MeSH term. Set to 0 to disable matching of MeSH terms. |
publicationMinedTermNormaliser | 1.0 |
0.0 |
1.0 |
Score normaliser for matching a publication mined term (EFO, GO). Set to 0 to disable matching of mined terms. |
publicationAbstractNormaliser | 0.985 |
0.0 |
1.0 |
Score normaliser for matching a publication abstract. Set to 0 to disable matching of abstracts. |
publicationFulltextNormaliser | 1.0 |
0.0 |
1.0 |
Score normaliser for matching a publication fulltext. Set to 0 to disable matching of fulltexts. |
docNormaliser | 1.0 |
0.0 |
1.0 |
Score normaliser for matching a query doc. Set to 0 to disable matching of docs. |
webpageNormaliser | 1.0 |
0.0 |
1.0 |
Score normaliser for matching a query webpage. Set to 0 to disable matching of webpages. |
Query weights¶
Parameter | Default | Min | Description |
---|---|---|---|
averageScaling | 10.0 |
0.0 |
Scaling for the average strategy |
nameWeight | 1.0 |
0.0 |
Weight of query name in average strategy. Set to 0 to disable matching of names in average strategy. |
keywordWeight | 1.0 |
0.0 |
Weight of query keyword in average strategy. Set to 0 to disable matching of keywords in average strategy. |
descriptionWeight | 1.0 |
0.0 |
Weight of query description in average strategy. Set to 0 to disable matching of descriptions in average strategy. |
publicationTitleWeight | 0.25 |
0.0 |
Weight of publication title in average strategy. Set to 0 to disable matching of titles in average strategy. |
publicationKeywordWeight | 0.75 |
0.0 |
Weight of publication keyword in average strategy. Set to 0 to disable matching of keywords in average strategy. |
publicationMeshWeight | 0.25 |
0.0 |
Weight of publication MeSH term in average strategy. Set to 0 to disable matching of MeSH terms in average strategy. |
publicationMinedTermWeight | 0.25 |
0.0 |
Weight of publication mined term (EFO, GO) in average strategy. Set to 0 to disable matching of mined terms in average strategy. |
publicationAbstractWeight | 0.75 |
0.0 |
Weight of publication abstract in average strategy. Set to 0 to disable matching of abstracts in average strategy. |
publicationFulltextWeight | 0.5 |
0.0 |
Weight of publication fulltext in average strategy. Set to 0 to disable matching of fulltexts in average strategy. |
docWeight | 0.5 |
0.0 |
Weight of query doc in average strategy. Set to 0 to disable matching of docs in average strategy. |
webpageWeight | 0.5 |
0.0 |
Weight of query webpage in average strategy. Set to 0 to disable matching of webpages in average strategy. |
Score limits¶
Parameter | Default | Min | Max | Description |
---|---|---|---|---|
goodScoreTopic | 0.63 |
0.0 |
1.0 |
Final scores over this are considered good (in topic branch) |
goodScoreOperation | 0.63 |
0.0 |
1.0 |
Final scores over this are considered good (in operation branch) |
goodScoreData | 0.63 |
0.0 |
1.0 |
Final scores over this are considered good (in data branch) |
goodScoreFormat | 0.63 |
0.0 |
1.0 |
Final scores over this are considered good (in format branch) |
badScoreTopic | 0.57 |
0.0 |
1.0 |
Final scores under this are considered bad (in topic branch) |
badScoreOperation | 0.57 |
0.0 |
1.0 |
Final scores under this are considered bad (in operation branch) |
badScoreData | 0.57 |
0.0 |
1.0 |
Final scores under this are considered bad (in data branch) |
badScoreFormat | 0.57 |
0.0 |
1.0 |
Final scores under this are considered bad (in format branch) |
outputGoodScores | true |
Output matches with good scores | ||
outputMediumScores | true |
Output matches with medium scores | ||
outputBadScores | false |
Output matches with bad scores | ||
passableBadScoreInterval | 0.04 |
0.0 |
1.0 |
Defines the passable bad scores (the best bad scores) as scores falling inside a score interval of given length, where the upper bound is fixed to the bad score limit |
passableBadScoresInTopN | 3 |
0 |
If a match with passable bad score would be among the top given number of matches, then it is included among the suggested matches (note that matches with any bad score are always included if outputBadScores is true ) |
|
topScorePartOutlier | 42.0 |
0.0 |
If mappingStrategy average is used, then each non-disabled and non-empty query part will have a corresponding score part. If the score of the top score part is more than the given number of times larger than the score of the next largest score part, then the entire match will be discarded. Only done in topic and operation branches and only when there are at least two score parts and only if the publication fulltext, doc or webpage query part is the top score part. Set to a value less than 1 to disable in all cases. |
Response¶
The response output can contain more or less information, depending on the specified type. The section of most interest is probably results in core.
core¶
- success
true
(iffalse
, then the JSON output of Error handling applies instead of the one below)- version
"1"
- type
"core"
- api
- URL of endpoint where request was sent
- txt
- Location of plain text results file (or
null
if not created) - html
- Location of HTML results directory (or
null
if not created) - json
- Location of JSON results file
- generator
Information about the application that generated the response
- name
- Name of the application
- url
- Homepage of the application
- version
- Version of the application
- time
- mapping
- query
- id
- Unique ID assigned to the query (and by extension, to this response)
- name
- Name of tool or service (as specified in query data,
null
if not specified) - keywords
- Array of strings representing keywords, tags, etc (as specified in query data,
null
if not specified) - description
- Short description of tool or service (as specified in query data,
null
if not specified) - webpageUrls
- Array of strings representing URLs of homepage, etc (as specified in query data,
null
if not specified) - docUrls
- Array of strings representing URLs of documentations (as specified in query data,
null
if not specified) - publicationIds
Array of objects representing IDs of journal articles (as specified in query data,
null
if not specified)- pmid
- PMID of article
- pmcid
- PMCID of article
- doi
- DOI of article
- annotations
- Array of EDAM URI strings representing existing annotations from EDAM (as specified in query data,
null
if not specified)
- results
- topic
Array of objects representing a matched term from the topic branch for the given query, ordered by score. If no results in topic branch, then empty array. If results in topic branch were not asked for in mapping parameters, then
null
.- edamUri
- EDAM URI of the matched term
- edamUriReplaced
- If replaceObsolete is
true
and this is a concept replacing a matched obsolete concept, then this contains the EDAM URI of that obsolete concept (that is replaced with the concept specified in edamUri) - label
- EDAM label of the matched term in edamUri
- obsolete
true
, if the term in edamUri is obsolete;false
otherwise- childOf
Array of objects that are parents of the current matched term in edamUri and that test
"fp"
. Absent if there are no such parents.- edamUri
- EDAM URI of a parent described above
- label
- EDAM label of such parent
- childOfAnnotation
- Array of objects that are parents of the current matched term in edamUri and that test
"tp"
. Same structure as in childOf. - childOfExcludedAnnotation
- Array of objects that are parents of the current matched term in edamUri and that test
"fn"
. Same structure as in childOf. - parentOf
- Array of objects that are children of the current matched term in edamUri and that test
"fp"
. Same structure as in childOf. - parentOfAnnotation
- Array of objects that are children of the current matched term in edamUri and that test
"tp"
. Same structure as in childOf. - parentOfExcludedAnnotation
- Array of objects that are children of the current matched term in edamUri and that test
"fn"
. Same structure as in childOf. - bestOneQuery
Best matched query part. Basis for bestOneScore calculation and score class determination using Score limits parameters. Basis for final score calculation if mappingStrategy is
"best"
. Otherwise (if mappingStrategy is"average"
), all query parts will be used for calculating final score (use type"full"
to see these partial scores). If replaceObsolete istrue
and this is a concept replacing a matched obsolete concept, then will contain match information of the obsolete concept specified in edamUriReplaced and not the actually suggested concept in edamUri.- type
- Name of the type of the query part
- url
- URL of best matched webpage/doc/publication. Absent, if type is not webpage, doc or some publication type.
- value
- Value of best matched keyword or publication keyword. Absent, if type is not keyword or some publication keyword type.
- bestOneConcept
Term part the best matched query part (bestOneQuery) matched with
- type
- Name of the type of the term part
- value
- Content of the term part. Absent, if type is
"none"
.
- score
- class
- One of
"good"
,"medium"
,"bad"
. Calculated based on Score limits parameters and the match score between bestOneQuery and bestOneConcept. - bestOneScore
- If mappingStrategy is
"average"
, then the match score between bestOneQuery and bestOneConcept will be stored here. If mappingStrategy is not"average"
, then will have negative value. - withoutPathScore
- If parentWeight and pathWeight are above
0
, then the non path enriched score will be stored here. Otherwise will have negative value. - score
- Final score of the match (to edamUriReplaced, if it exists, or to edamUri otherwise)
- test
"tp"
, if term was matched and also specified as existing annotation in the query;"fp"
, if term was matched, but not specified as existing annotation in query;"fn"
, if term was not matched, but was specified as existing annotation in query
- operation
- Same structure as in topic, but for terms matched from the operation branch
- data
- Same structure as in topic, but for terms matched from the data branch
- format
- Same structure as in topic, but for terms matched from the format branch
- args
The Parameters
- mainArgs
Main parameters
- edam
- Filename of the used EDAM ontology OWL file
- txt
true
, if output of plain text results was requested;false
otherwise- html
true
, if output of HTML results was requested;false
otherwise- json
- Always
true
- processorArgs
Processing parameters
- preProcessorArgs
- Preprocessing parameters
- fetcherArgs
- Fetching parameters (implemented in PubFetcher)
- mapperArgs
Mapping parameters
- algorithmArgs
- Mapping algorithm parameters
- idfArgs
- IDF parameters
- multiplierArgs
- Concept multipliers parameters
- normaliserArgs
- Query normalisers parameters
- weightArgs
- Query weights parameters
- scoreArgs
- Score limits parameters
- tool
- Present, if query data was supplied as bio.tools input. The structure and content of this object is the same as in the object supplied as part of the query, except that
null
and empty values are removed. In addition, results from the topic branch are added to the topic attribute and results from the operation branch are added under a new function group object. Results from the data and format branches should be added under the"input"
and"output"
attributes of a function group, however EDAMmap can’t differentiate between inputs and outputs. Thus, new terms from the data and format branches will be added as strings (in the form"EDAM URI (label)"
, separated by" | "
) to the note of the last function group object.
full¶
The type "full"
includes everything from core, plus the following:
- mapping
- queryFetched
- webpages
- Array of metadata objects corresponding to webpageUrls in query. Webpages are implemented in PubFetcher and thus are described in its documentation: Content of webpages. The structure of webpages here will be the same as described in PubFetcher, except for content which will be missing. The values of startUrl of webpages will be the URLs given in webpageUrls in query.
- docs
- Array of metadata objects corresponding to docUrls in query. Structure of objects same as in webpages.
- publications
- Array of metadata objects corresponding to publicationIds in query. Publications are implemented in PubFetcher and thus are described in its documentation: Content of publications. The structure of publications here will be the same as described in PubFetcher, except for fulltext which will be missing.
- results
- topic/operation/data/format
Array of objects defined in topic, i.e. the same content as in core, plus the field parts defined below.
- parts
Array of objects representing scores from each query part that are used in calculating the final score (using weights from Query weights parameters), in case mappingStrategy is
"average"
. Absent, if mappingStrategy is not"average"
.- queryMatch
- type
- Name of the type of the query part
- url
- URL of best matched webpage/doc/publication. Absent, if type is not webpage, doc or some publication type.
- value
- Value of best matched keyword or publication keyword. Absent, if type is not keyword or some publication keyword type.
- score
- Intermediate score of matching to query part from all concept term parts
- conceptMatch
- type
- Name of the type of the term part
- value
- Content of the term part. Absent, if type is
"definition"
,"comment"
or"none"
. - score
- Intermediate score of matching to concept term part from query part
- score
- Score of the part
- counts
- conceptsSize
- Total number of concepts in the used EDAM ontology
- topicSize
- Number of concepts in the topic branch
- operationSize
- Number of concepts in the operation branch
- dataSize
- Number of concepts in the data branch
- formatSize
- Number of concepts in the format branch
- queriesSize
- Number of queries. Always
1
. Can be bigger in output of EDAMmap-CLI. - resultsSize
- Number of results. Always
1
. Can be bigger in output of EDAMmap-CLI. - tp
- topic
- Number of matched terms from the topic branch that test
"tp"
- operation
- Number of matched terms from the operation branch that test
"tp"
- data
- Number of matched terms from the data branch that test
"tp"
- format
- Number of matched terms from the format branch that test
"tp"
- total
- Total number of matched terms that test
"tp"
- fp
- Same structure as in tp, but for matched terms that test
"fp"
- fn
- Same structure as in tp, but for matched terms that test
"fn"
- measures
Measures of EDAMmap performance against existing annotations provided in query. Does not make much sense in case of one query-results pair (if queriesSize and resultsSize are
1
), but included for completeness.- precision
-
- topic
- Precision in the topic branch
- operation
- Precision in the operation branch
- data
- Precision in the data branch
- format
- Precision in the format branch
- total
- Precision over all branches
- recall
- Recall. Same structure as in precision.
- f1
- F1 score. Same structure as in precision.
- f2
- F2 score. Same structure as in precision.
- Jaccard
- Jaccard index. Same structure as in precision.
- AveP
- Average precision. Same structure as in precision.
- RP
- R-precision. Same structure as in precision.
- DCG
- Discounted cumulative gain. Same structure as in precision.
- DCGa
- DCG (alternative). Same structure as in precision.
Examples¶
One way to test the API is to send JSON data using curl
. For example, for sending the input:
{
"name": "aTool"
}
issue the command:
$ curl -H "Content-Type: application/json" -X POST -d '{"name":"aTool"}' https://biit.cs.ut.ee/edammap/api
In the output, no results can be seen:
"results" : {
"topic" : [ ],
"operation" : [ ],
"data" : null,
"format" : null
}
Which is not surprising, given only the tool name was supplied (“aTool”), which is too little for EDAMmap to work with.
A more meaningful input might look like this:
{
"name": "g:Profiler",
"keywords": [ "gene set enrichment analysis", "Gene Ontology" ],
"description": "A web server for functional enrichment analysis and conversions of gene lists.",
"webpageUrls": [ "https://biit.cs.ut.ee/gprofiler/" ],
"docUrls": [ "https://biit.cs.ut.ee/gprofiler/help.cgi" ],
"publicationIds": [
"17478515\t\t10.1093/nar/gkm226",
{
"pmcid": "PMC3125778"
},
{
"pmid": "27098042",
"doi": "10.1093/nar/gkw199"
}
],
"annotations": [
"http://edamontology.org/topic_1775",
"operation_2436",
"data_3021",
"http://edamontology.org/format_1964"
],
"branches": [ "topic", "operation", "data", "format" ],
"matches": 6,
"obsolete": true
}
For testing, this input could be saved in a file, e.g. input.json
, and then the following command run:
$ curl -H "Content-Type: application/json" -X POST -d '@/path/to/input.json' https://biit.cs.ut.ee/edammap/api
To supply the same data (except the “keywords”) as bio.tools input, the following could be used:
{
"tool": {
"name": "g:Profiler",
"description": "A web server for functional enrichment analysis and conversions of gene lists.",
"homepage": "https://biit.cs.ut.ee/gprofiler/",
"documentation": [{
"url": "https://biit.cs.ut.ee/gprofiler/help.cgi",
"type": "General",
"note": null
}],
"publication": [{
"pmid": "17478515",
"pmcid": null,
"doi": "10.1093/nar/gkm226"
},{
"pmcid": "PMC3125778"
},{
"pmid": "27098042",
"pmcid": null,
"doi": "10.1093/nar/gkw199"
}],
"topic": [{
"term": "Function analysis",
"uri": "http://edamontology.org/topic_1775"
}],
"function": [{
"operation": [{
"term": "Gene-set enrichment analysis",
"uri": "http://edamontology.org/operation_2436"
}],
"input": [{
"data": {
"uri": "http://edamontology.org/data_3021"
},
"format": [{
"uri": "http://edamontology.org/format_1964"
}]
}],
"output": null
}]
},
"branches": [ "topic", "operation", "data", "format" ],
"matches": 6,
"obsolete": true
}
Prefetching¶
Once a query has been received by the API, content corresponding to webpageUrls, docUrls and publicationIds has to be fetched (unless it has been fetched and stored in some previous occurrence), before mapping can take place.
This content could be prefetched and prestored in the database as a separate step, before the mapping query is sent. This is useful in the web application, where content can be fetched as soon as the user has entered the corresponding query details, and thus mapping time could be less when the entire query form is finally submitted. It might be of less use in the API, but has been included nevertheless.
/api/web¶
Request¶
Links, whose content is to be prefetched, are specified as an array of strings under the JSON key webpageUrls.
In addition to webpageUrls, parameters from Fetching can be used, as these can influence the fetching.
Response¶
The main result of the query is not the content of the response itself, but the fact that the contents of the requested links were stored in the database on the server. However, some informational output is still provided.
- success
true
(iffalse
, then the JSON output of Error handling applies instead of the one below)- webpageUrls
Array of objects describing the completeness of the content of each link on the server
/api/doc¶
Analogous to /api/web, except for documentation and that the JSON key docUrls has to be used.
/api/pub¶
Request¶
Journal articles, whose content is to be prefetched, are specified using a PMID and/or PMCID and/or DOI. This is done as an array of strings and objects under the JSON key publicationIds. If the ID is specified as a string, it has to be in the form "<PMID>\t<PMCID>\t<DOI>"
. If it is specified as an object, the keys "pmid"
, "pmcid"
, "doi"
are to be used.
In addition to publicationIds, parameters from Fetching can be used, as these can influence the fetching.
Response¶
The main result of the query is not the content of the response itself, but the fact that the contents of the requested articles were stored in the database on the server. However, some informational output is still provided.
- success
true
(iffalse
, then the JSON output of Error handling applies instead of the one below)- publicationIds
Array of objects describing the completeness of the content of each article on the server
- id
IDs describing one publication specified in the request
- pmid
- The PMID of the publication
- pmcid
- The PMCID of the publication
- doi
- The DOI of the publication
- status
- The status of that publication. One of “empty”, “non-usable”, “non-final”, “final”, “totally final”.
Example¶
Try to prefetch the publication with PMID “23479348” and PMCID “PMC3654706”, increasing connect and read timeout to give the server more time to fetch the whole publication:
$ curl -H "Content-Type: application/json" -X POST -d '{"publicationIds":["23479348\tPMC3654706\t"],"timeout":30000}' https://biit.cs.ut.ee/edammap/api/pub
Sample output:
{
"success" : true,
"publicationIds" : [ {
"id" : {
"pmid" : "23479348",
"pmcid" : "PMC3654706",
"doi" : "10.1093/BIOINFORMATICS/BTT113"
},
"status" : "final"
} ]
}
Error handling¶
If "success"
is true
in the JSON response, then HTTP status code was “200 OK” and the rest of the JSON is in the format described above.
If "success"
is false
in the JSON response, then something has gone wrong, the HTTP status code is 400 Bad Request or 500 Internal Server Error and the rest of the JSON will be in one of the following formats.
400 Bad Request¶
Status code 400 means something was done wrong on the client side (syntax error, bad parameter value, etc) and the error should be fixed by the client, before another attempt is made.
The output JSON will have the following format:
- success
false
- status
400
- message
- A string describing the error
- time
- Timestamp string (as ISO 8601 combined date and time) when the error occurred
500 Internal Server Error¶
Status code 500 is a catch all for all other errors. Usually, it should be some problem on the server side. It might be temporary, so another try later might result in success. It might also be an unforeseen problem on the client side. There’s a strong chance there is a bug somewhere, so feedback with a timestamp is appreciated (to GitHub issues or by contacting the author).
The output JSON will have the following format:
- success
false
- status
500
- time
- Timestamp string (as ISO 8601 combined date and time) when the error occurred
Examples¶
Syntax error in JSON¶
$ curl -H "Content-Type: application/json" -X POST -d '{"name"}' https://biit.cs.ut.ee/edammap/api
{
"success": false,
"status": 400,
"message": "Invalid token=CURLYCLOSE at (line no=1, column no=8, offset=7). Expected tokens are: [COLON]",
"time": "2018-05-28T12:59:57.389Z"
}
Bad parameter value¶
$ curl -H "Content-Type: application/json" -X POST -d '{"name":"test","goodScoreTopic":2}' https://biit.cs.ut.ee/edammap/api
{
"success": false,
"status": 400,
"message": "Param 'goodScoreTopic=2.0' is above limit 1.0",
"time": "2018-05-28T13:02:53.616Z"
}
Some other illegal requests¶
$ curl -H "Content-Type: application/json" -X POST -d '{"name":"test","annotations":["http://edamontology.org/1775"]}' https://biit.cs.ut.ee/edammap/api
{
"success": false,
"status": 400,
"message": "Illegal EDAM URI: http://edamontology.org/1775",
"time": "2018-05-28T14:07:50.164Z"
}
$ curl -H "Content-Type: application/json" -X POST -d '{"name":"test","publicationIds":["23479348\tPMC3654706"]}' https://biit.cs.ut.ee/edammap/api
{
"success": false,
"status": 400,
"message": "Publication ID has illegal number of parts (2), first part is 23479348",
"time": "2018-05-28T14:09:04.032Z"
}
$ curl -H "Content-Type: application/json" -X POST -d '{"name":"test","webpageUrls":["biit.cs.ut.ee/gprofiler"]}' https://biit.cs.ut.ee/edammap/api
{
"success": false,
"status": 400,
"message": "Malformed URL: biit.cs.ut.ee/gprofiler",
"time": "2018-05-28T14:10:23.651Z"
}