Difference between revisions of "BioPortal REST services"

From NCBO Wiki
Jump to navigation Jump to search
 
(363 intermediate revisions by 17 users not shown)
Line 1: Line 1:
This page documents BioPortal Web Service signatures. The list below contains commonly accessed BioPortal Web services and is not intended to be an exhaustive list. If a feature you are interested in is not in the list below, please contact [mailto:support@bioontology.org BioPortal Support] to request the service or ask for more details on the full list of services.
+
NCBO BioPortal v4.0 REST services are documented at: http://data.bioontology.org/documentation
 
 
The '''prefix''' for all service URLs in the table below is http://rest.bioontology.org/bioportal/
 
 
 
* '''Note''': All NCBO REST web service calls MUST append a user identification query parameter with the pattern of "email=UserEmail" (note some clients may need to use URL encoding). For example, email=example@example.org or email=example%40example.org as an encoded email. Please start adding the user identification URL parameter to all your web service invocations. Later in 2009, we may start challenging REST service calls that do not have this parameter. 
 
 
 
* '''Note''': ''Signatures for BioPortal services have changed in BioPortal 2.0.4 release on January 13th, 2009. This page has the new service URLs. If you have any questions, please contact [mailto:support@bioontology.org BioPortal Support].''
 
 
 
 
 
= Services to access ontologies and ontology versions =
 
 
 
== List all the latest version of ontologies ==
 
 
 
* '''Signature''': ./ontologies?email={email_address}
 
* '''Example''': http://rest.bioontology.org/bioportal/ontologies?email=example@example.org
 
 
 
==  Get a specific ontology based on a version id ==
 
* '''Signature''':  ./ontologies/{ontology version id}?email={email_address}
 
* '''Example''':  http://rest.bioontology.org/bioportal/ontologies/39002?email=example@example.org
 
 
 
==  Download an ontology file ==
 
* '''Description''': Download the file (.obo, .owl) corresponding to the given ontology version ID.
 
* '''Signature''':  ./ontologies/download/{ontology version id}?email={email_address}
 
* '''Example''': http://rest.bioontology.org/bioportal/ontologies/download/39002?email=example@example.org
 
 
 
==  Get all versions of an ontology form a virtual ontology id ==
 
* '''Signature''': ./ontologies/versions/{ontology id}?email={email_address}
 
* '''Example''': http://rest.bioontology.org/bioportal/ontologies/versions/1104?email=example@example.org
 
 
 
==  Get latest version of an ontology id ==
 
* '''Signature''':  ./virtual/{ontology_id}?email={email_address}
 
* '''Example''': http://rest.bioontology.org/bioportal/virtual/1104?email=example@example.org
 
 
 
==  List all ontology categories id ==
 
* '''Signature''':  ./categories?email={email_address}
 
* '''Example''': http://rest.bioontology.org/bioportal/categories
 
 
 
= Concept services =
 
 
 
==  Get concept  ==
 
* '''Signature''': ./concepts/{ontology version id}/{concept id}?email={email_address}
 
* '''Example''': http://rest.bioontology.org/bioportal/concepts/39002/BRO:Resource?email=example@example.org
 
 
 
==  Get all root concepts for an ontology id ==
 
* '''Signature''': ./concepts/{ontology version id}/root?email={email_address}
 
* '''Example''': http://rest.bioontology.org/bioportal/concepts/39002/root?email=example@example.org
 
 
 
==  Get concept for latest ontology version id ==
 
* '''Signature''': ./virtual/{ontology id}/{concept id}?email={email_address}
 
* '''Example''': http://rest.bioontology.org/bioportal/virtual/1104/BRO:Resource?email=example@example.org
 
 
 
= Search services =
 
 
 
==  Search BioPortal ==
 
* '''Signature''': ./search/{query}[?{optional args}]&email={email_address}
 
* '''Example''': http://rest.bioontology.org/bioportal/search/Gene?email=example@example.org
 
* You can use multiple query terms, separated by a space, for example: [http://rest.bioontology.org/bioportal/search/lung%20disease http://rest.bioontology.org/bioportal/search/lung disease?email=example@example.org]
 
* '''Optional arguments:'''
 
** ontologyids=<ontologyid>,<ontologyid>… - limits the search to specific ontologies (default: all ontologies)
 
** isexactmatch=[1/0] – match the entire concept name (default: 0)
 
** includeproperties=[1/0] – include attributes in the search (default: 0)
 
** pagesize=<pagesize> - the number of results to display in a single request (default: all)
 
** pagenum=<pagenum> - the page number to display (pages are calculated using <total results>/<pagesize>) (default: 1)
 
** maxnumhits=<maxnumhits> - the maximum number of top matching results to return (default: 1000)
 
* '''Description:'''
 
The search attempts to match both partial and exact queries, giving more weight to exact matches. In single-word searches, the wildcard character (*) is automatically appended to the end of the word. For example, searching for "lun" would return all concepts whose name contains a word that begins with "lun" (i.e. "Lung", "Murine Lunate Bone", "Base of the Lung", etc).
 
 
 
In phrase searches (multiple words), the wildcard character is appended to the last word. For example, searching for "cutaneous mela" would return all concepts whose name contains the word "cutaneous", followed by any word that begins with "mela" (i.e. "Cutaneous Melanoma", "Metastatic Non-Cutaneous Melanoma", "Cutaneous Melanoma Clinical TNM Finding", etc).
 
 
 
* '''Example''': http://rest.bioontology.org/bioportal/search/software/?ontologyids=1104&isexactmatch=1&email=example@example.org
 
* '''Sample Output''':
 
<pre>
 
<?xml version="1.0" encoding="UTF-8" ?>
 
<success>
 
<accessedResource>
 
/bioportal/search/cutaneous%20mela
 
</accessedResource>
 
<accessDate>2009-05-07 16:17:46.182 PDT</accessDate>
 
<data>
 
<page>
 
<pageNum>1</pageNum>
 
<numPages>1</numPages>
 
<pageSize>3</pageSize>
 
<numResultsPage>3</numResultsPage>
 
<numResultsTotal>3</numResultsTotal>
 
<contents
 
class="org.ncbo.stanford.bean.search.SearchResultListBean">
 
<searchResultList>
 
<searchBean>
 
<ontologyVersionId>39715</ontologyVersionId>
 
<ontologyId>1136</ontologyId>
 
<ontologyDisplayLabel>
 
Experimental Factor Ontology
 
</ontologyDisplayLabel>
 
<recordType>
 
RECORD_TYPE_PREFERRED_NAME
 
</recordType>
 
<conceptId>
 
http://www.ebi.ac.uk/efo/EFO_0000389
 
</conceptId>
 
<conceptIdShort>EFO_0000389</conceptIdShort>
 
<preferredName>
 
cutaneous melanoma
 
</preferredName>
 
<contents>cutaneous melanoma</contents>
 
</searchBean>
 
<searchBean>
 
<ontologyVersionId>39478</ontologyVersionId>
 
<ontologyId>1032</ontologyId>
 
<ontologyDisplayLabel>
 
NCI Thesaurus
 
</ontologyDisplayLabel>
 
<recordType>
 
RECORD_TYPE_PREFERRED_NAME
 
</recordType>
 
<conceptId>
 
http://ncicb.nci.nih.gov/xml/owl/EVS/Thesaurus.owl#Cutaneous_Melanoma
 
</conceptId>
 
<conceptIdShort>
 
Cutaneous_Melanoma
 
</conceptIdShort>
 
<preferredName>
 
Cutaneous Melanoma
 
</preferredName>
 
<contents>Cutaneous Melanoma</contents>
 
</searchBean>
 
<searchBean>
 
<ontologyVersionId>39833</ontologyVersionId>
 
<ontologyId>1009</ontologyId>
 
<ontologyDisplayLabel>
 
Human disease
 
</ontologyDisplayLabel>
 
<recordType>
 
RECORD_TYPE_PREFERRED_NAME
 
</recordType>
 
<conceptId>DOID:2418</conceptId>
 
<conceptIdShort>DOID:2418</conceptIdShort>
 
<preferredName>
 
Cutaneous Melanocytic Neoplasm
 
</preferredName>
 
<contents>
 
Cutaneous Melanocytic Neoplasm
 
</contents>
 
</searchBean>
 
</searchResultList>
 
<ontologyHitList>
 
<ontologyHitBean>
 
<ontologyVersionId>39715</ontologyVersionId>
 
<ontologyId>1136</ontologyId>
 
<ontologyDisplayLabel>
 
Experimental Factor Ontology
 
</ontologyDisplayLabel>
 
<numHits>1</numHits>
 
</ontologyHitBean>
 
<ontologyHitBean>
 
<ontologyVersionId>39833</ontologyVersionId>
 
<ontologyId>1009</ontologyId>
 
<ontologyDisplayLabel>
 
Human disease
 
</ontologyDisplayLabel>
 
<numHits>1</numHits>
 
</ontologyHitBean>
 
<ontologyHitBean>
 
<ontologyVersionId>39478</ontologyVersionId>
 
<ontologyId>1032</ontologyId>
 
<ontologyDisplayLabel>
 
NCI Thesaurus
 
</ontologyDisplayLabel>
 
<numHits>1</numHits>
 
</ontologyHitBean>
 
</ontologyHitList>
 
</contents>
 
</page>
 
</data>
 
</success>
 
</pre>
 
 
 
=  Hierarchy Services =
 
 
 
==  Get parents/children of a given concept in a specific ontology version ==
 
* '''Signature''': ./concepts/[parents|children]/{ontlogyVersionId}/{conceptId}[?email={email_address}&{optional args}]
 
* '''Example''': http://rest.bioontology.org/bioportal/concepts/parents/13578/Melanoma?email=example@example.org
 
* '''Example''': http://rest.bioontology.org/bioportal/concepts/children/13578/Melanoma?email=example@example.org
 
* '''Optional arguments:'''
 
** level=<integer> - limits results to a given level in the hierarchy
 
** offset=<integer> – results offset (used for pagination)
 
** limit=<integer> – limits the number of results
 
** '''Example''': http://rest.bioontology.org/bioportal/concepts/parents/13578/Melanoma?level=1&offset=1&limit=10&email=example@example.org
 
* '''Description''': returns all parents of the concept, with the level indicating how far away the parent is from the concept. For instance, direct parents have level 1; their direct parents have level 2, etc. If no level is specified, the service returns all the levels up to the root. If the level is specified, the service returns only the parents at that level.
 
* '''Note:''' These services accept UMLS Abbreviated source name (SAB) for ontlogyVersionId and UMLS Unique identifier for concept (CUI) for conceptId.
 
* '''Sample Output:'''
 
<pre>
 
<?xml version="1.0" encoding="UTF-8" ?>
 
<success>
 
<accessedResource>
 
/bioportal/virtual/parents/MSH/C0025202
 
</accessedResource>
 
<accessDate>2009-04-21 10:55:33.494 PDT</accessDate>
 
<data>
 
<list>
 
<classBean>
 
<ontologyVersionId>MSH</ontologyVersionId>
 
<id>C0206769</id>
 
<relations>
 
<entry>
 
<string>Level</string>
 
<int>1</int>
 
</entry>
 
</relations>
 
</classBean>
 
<classBean>
 
<ontologyVersionId>MSH</ontologyVersionId>
 
<id>C0206754</id>
 
<relations>
 
<entry>
 
<string>Level</string>
 
<int>1</int>
 
</entry>
 
</relations>
 
</classBean>
 
</list>
 
</data>
 
</success>
 
</pre>
 
 
 
==  Get parents/children of a given concept in the latest version of a given ontology ==
 
* '''Signature''': ./virtual/[parents|children]/{ontlogyId}/{conceptId}[?email={email_address}&{optional args}]
 
* '''Example''': http://rest.bioontology.org/bioportal/virtual/parents/1009/DOID:1909?email=example@example.org
 
* '''Example''': http://rest.bioontology.org/bioportal/virtual/children/1009/DOID:1909?email=example@example.org
 
* '''Optional arguments:'''
 
** level=<integer> - limits results to a given level in the hierarchy
 
** offset=<integer> – results offset (used for pagination)
 
** limit=<integer> – limits the number of results
 
** '''Example''': http://rest.bioontology.org/bioportal/virtual/parents/1009/DOID:1909?level=1&offset=1&limit=3&email=example@example.org
 
* '''Description''': The same as the previous services, but takes an ontology id and returns parents from the latest version of that ontology.
 
 
 
==  Get paths to roots/leaves from a concept in a specific ontology version ==
 
* '''Signature''': ./concepts/[rootpath|leafpath]/{ontologyVersionId}/{conceptId}[?email={email_address}&{optional args}]
 
* '''Example''': http://rest.bioontology.org/bioportal/concepts/rootpath/13578/Melanoma?email=example@example.org
 
* '''Example''': http://rest.bioontology.org/bioportal/concepts/leafpath/13578/Melanoma?email=example@example.org
 
* '''Optional arguments:'''
 
** offset=<integer> – results offset (used for pagination)
 
** limit=<integer> – limits the number of results
 
* '''Description''': return a set of path to the roots (resp. leaves) for a given concept in a specific ontology version. Paths are represented as a list of conceptIds, separated by periods (.) The first one in the list is a root (resp. leaf) in the hierarchy; the last one in the list is the direct parent (resp. direct child) of the concept.
 
* '''Note:''' These services accepts UMLS Abbreviated source name (SAB) for ontlogyVersionId and UMLS Unique identifier for concept (CUI) fro conceptId.
 
* '''Sample Output:'''
 
<pre>
 
<?xml version="1.0" encoding="UTF-8" ?>
 
<success>
 
<accessedResource>
 
/bioportal/concepts/rootpath/13578/Melanoma
 
</accessedResource>
 
<accessDate>2009-04-21 11:06:23.439 PDT</accessDate>
 
<data>
 
<list>
 
<classBean>
 
<ontologyVersionId>13578</ontologyVersionId>
 
<id>Melanoma</id>
 
<relations>
 
<entry>
 
<string>Path</string>
 
<string>
 
Getings_and_Disorders_Kind.Diseases_Disorders_and_Getings.Diseases_and_Disorders.Neoplasm.Neoplasm_by_Morphology.Melanocytic_Neoplasm
 
</string>
 
</entry>
 
</relations>
 
</classBean>
 
<classBean>
 
<ontologyVersionId>13578</ontologyVersionId>
 
<id>Melanoma</id>
 
<relations>
 
<entry>
 
<string>Path</string>
 
<string>
 
Getings_and_Disorders_Kind.Diseases_Disorders_and_Getings.Diseases_and_Disorders.Neoplasm.Neoplasm_by_Special_Category.Common_Neoplasm
 
</string>
 
</entry>
 
</relations>
 
</classBean>
 
</list>
 
</data>
 
</success>
 
</pre>
 
 
 
==  Get paths to root/leaves from a concept in the latest version of a given ontology  ==
 
* '''Signature''': ./virtual/[rootpath|leafpath]/{ontologyId}/{conceptId}[?email={email_address}&{optional args}]
 
* '''Example''': http://rest.bioontology.org/bioportal/virtual/rootpath/1009/DOID:1909?email=example@example.org
 
* '''Example''': http://rest.bioontology.org/bioportal/virtual/leafpath/1009/DOID:1909?email=example@example.org
 
* '''Optional arguments:'''
 
** offset=<integer> – results offset (used for pagination)
 
** limit=<integer> – limits the number of results
 
* '''Description''': The same as the previous services, but takes an ontology id and returns parents from the latest version of that ontology.
 
 
 
==  Get siblings of a given concept in a specific ontology version ==
 
* '''Signature''': ./concepts/siblings/{ontlogyVersionId}/{conceptId}?level=<level>&email={email_address}&[&{optional args}]
 
* '''Example''': http://rest.bioontology.org/bioportal/concepts/siblings/13578/Melanoma?level=1&email=example@example.org
 
* '''Required arguments:'''
 
** level=<integer> - limits results to a given level in the hierarchy
 
* '''Optional arguments:'''
 
** offset=<integer> – results offset (used for pagination)
 
* '''Description''': returns the set of sibling concepts at the given level (i.e., siblings that have the same direct (level=1), grand-parents (level=2), etc.) for a given concept.
 
* '''Note:''' These services accepts UMLS Abbreviated source name (SAB) for ontlogyVersionId and UMLS Unique identifier for concept (CUI) fro conceptId.
 
* '''Sample Output:'''
 
<pre>
 
<?xml version="1.0" encoding="UTF-8" ?>
 
<success>
 
<accessedResource>
 
/bioportal/concepts/siblings/13578/Melanoma
 
</accessedResource>
 
<accessDate>2009-04-21 11:15:13.427 PDT</accessDate>
 
<data>
 
<list>
 
<classBean>
 
<ontologyVersionId>13578</ontologyVersionId>
 
<id>Common_Germ_Cell_Neoplasm</id>
 
<relations>
 
<entry>
 
<string>Level</string>
 
<int>1</int>
 
</entry>
 
</relations>
 
</classBean>
 
<classBean>
 
<ontologyVersionId>13578</ontologyVersionId>
 
<id>Common_Hematopoietic_Neoplasm</id>
 
<relations>
 
<entry>
 
<string>Level</string>
 
<int>1</int>
 
</entry>
 
</relations>
 
</classBean>
 
</list>
 
</data>
 
</success>
 
</pre>
 
 
 
==  Get siblings of a given concept in the latest version of a given ontology ==
 
* '''Signature''': ./virtual/siblings/{ontlogyId}/{conceptId}?level=<level>&email={email_address}&[&{optional args}]
 
* '''Example''': http://rest.bioontology.org/bioportal/virtual/siblings/1009/DOID:1909?level=1&email=example@example.org
 
* '''Required arguments:'''
 
** level=<integer> - limits results to a given level in the hierarchy
 
* '''Optional arguments:'''
 
** offset=<integer> – results offset (used for pagination)
 
* '''Description''': The same as the previous service, but takes an ontology id and returns parents from the latest version of that ontology.
 
 
 
==  Usage Logging ==
 
* '''Signature''': ./usage?{args}
 
* '''Example''': http://rest.bioontology.org/bioportal/usage?requesturl=ontologies&resourceparameters=13578
 
* '''Required arguments:'''
 
** none specifically, but at least one optional argument is required
 
* '''Optional arguments:'''
 
** requesturl=<string contained in request url> – limit results to a given string contained in REST service request url
 
** resourceparameters=<string contained in resource parameters> – limit results to a given string contained in resource parameters. For example, in the URL http://rest.bioontology.org/bioportal/search/melanoma, the word "melanoma" is considered a "resource parameter".
 
** startdateaccessed=<date in format mm/dd/yyyy> – limit results to the given starting date (default: no starting date)
 
** startdateaccessed=<date in format mm/dd/yyyy> – limit results to the given ending date (default: today's date)
 
* '''Description''': returns BioPortal REST services usage data as XML.
 
* '''Sample Output:'''
 
<pre>
 
<?xml version="1.0" encoding="UTF-8" ?>
 
<success>
 
<accessedResource>/bioportal/usage</accessedResource>
 
<accessDate>2009-07-27 14:21:19.728 PDT</accessDate>
 
<data>
 
<list>
 
<usageLoggingBean>
 
<requestUrl>
 
/search/Certain infectious and parasitic diseases/
 
</requestUrl>
 
<httpMethod>GET</httpMethod>
 
<resourceParameters>
 
query=Certain%20infectious%20and%20parasitic%20diseases
 
</resourceParameters>
 
<requestParameters>
 
pagenum=1&ontologyids=1265&pagesize=20
 
</requestParameters>
 
<hitCount>1</hitCount>
 
<dateAccessed class="sql-timestamp">
 
2009-07-27 00:00:00.0
 
</dateAccessed>
 
</usageLoggingBean>
 
<usageLoggingBean>
 
<requestUrl>/search/Hypertension/</requestUrl>
 
<httpMethod>GET</httpMethod>
 
<resourceParameters>
 
query=Hypertension
 
</resourceParameters>
 
<requestParameters>
 
pagenum=1&ontologyids=1265&pagesize=20
 
</requestParameters>
 
<hitCount>2</hitCount>
 
<dateAccessed class="sql-timestamp">
 
2009-07-27 00:00:00.0
 
</dateAccessed>
 
</usageLoggingBean>
 
<usageLoggingBean>
 
<requestUrl>/search/Melanoma/</requestUrl>
 
<httpMethod>GET</httpMethod>
 
<resourceParameters>query=Melanoma</resourceParameters>
 
<requestParameters>
 
pagenum=1&ontologyids=1265&pagesize=20
 
</requestParameters>
 
<hitCount>3</hitCount>
 
<dateAccessed class="sql-timestamp">
 
2009-07-27 00:00:00.0
 
</dateAccessed>
 
</usageLoggingBean>
 
</list>
 
</data>
 
</success>
 
</pre>
 

Latest revision as of 23:00, 16 July 2016

NCBO BioPortal v4.0 REST services are documented at: http://data.bioontology.org/documentation