Help:WikiPathways Webservice/API
From WikiPathways
Line 5: | Line 5: | ||
This page documents WikiPathways REST API calls. For more information on libraries and code examples, see [[Help:WikiPathways_Webservice|WikiPathways web services]]. | This page documents WikiPathways REST API calls. For more information on libraries and code examples, see [[Help:WikiPathways_Webservice|WikiPathways web services]]. | ||
- | The default return format is xml. Data can also be returned as JSON and html. Try it out using [http://www.wikipathways.org/wpi/webservicetest/ui/dist/#!/default/ Swagger] or at [http://webservice.wikipathways.org webservice.wikipathways.org]. | + | The default return format is xml. Data can also be returned as JSON and html. Try it out using [http://www.wikipathways.org/wpi/webservicetest/ui/dist/#!/default/ Swagger] (this may require you to set the URL at the top to http://www.wikipathways.org/wpi/webservicetest/index.php?swagger) or at [http://webservice.wikipathways.org webservice.wikipathways.org]. |
=== Functions === | === Functions === |
Revision as of 18:39, 22 August 2015
This page documents WikiPathways REST API calls. For more information on libraries and code examples, see WikiPathways web services.
The default return format is xml. Data can also be returned as JSON and html. Try it out using Swagger (this may require you to set the URL at the top to http://www.wikipathways.org/wpi/webservicetest/index.php?swagger) or at webservice.wikipathways.org.
Functions
listOrganisms
listPathways
Get a list of all available pathways.
Example: http://webservice.wikipathways.org/listPathways
Arguments:
-
string
organism- Only return pathways for this organism (optional).
getPathway
Download the pathway from WikiPathways.
Example: http://webservice.wikipathways.org/getPathway?pwId=WP4&revision=40020
Arguments:
-
string
pwId- The pathway identifier.
-
integer
revision- The revision number of the pathway (use '0' for most recent version).
getPathwayInfo
Get some general info about the pathway, such as the name, species, without downloading the GPML.
Example: http://webservice.wikipathways.org/getPathwayInfo?pwId=WP4
Arguments:
-
string
pwId- The pathway identifier.
getPathwayHistory
Get the revision history of a pathway.
Example: http://webservice.wikipathways.org/getPathwayHistory?pwId=WP4×tamp=20110101000000
Arguments:
-
string
pwId- The pathway identifier.
-
string
timestamp- Limit the results by date, only history items after the given timestamp will be included.
getRecentChanges
Get the recently changed pathways.
Note: the recent changes table only retains items for a limited time (2 months), so there is no guarantee that you will get all changes when the timestamp points to a date that is more than 2 months in the past.
Example: http://webservice.wikipathways.org/getRecentChanges?timestamp=20110101000000
Arguments:
-
string
timestamp- Only get changes from after this time. Timestamp format: yyyymmddMMHHSS.
login
Start a logged in session, using an existing WikiPathways account. This function will return an authentication code that can be used to excecute methods that need authentication (e.g. updatePathway).
Arguments:
-
string
name- The username of the WikiPathways account.
-
string
pass- The password of the WikiPathways account.
getPathwayAs
Download a pathway in the specified file format.
Example: http://webservice.wikipathways.org/index.php?fileType=gpml&pwId=WP4&revision=0&method=getPathwayAs
Arguments:
-
string
fileType- Download a pathway in the specified file format.
- gpml
- png
- svg
- txt
- pwf
- owl (for BioPAX level 3)
See the download page for an explanation of these file formats.
-
string
pwId- The pathway identifier.
-
integer
revision- The revision number of the pathway (use '0' for most recent version).
Note: This method could not be exposed through our REST interface. So, for REST access use this syntax instead: http://webservice.wikipathways.org/index.php?fileType=png&pwId=WP4&revision=0&method=getPathwayAs
updatePathway
Update a pathway on the wiki with the given GPML code.
Note: To create/modify pathways via the web service, you need to have an account with web service write permissions. Please contact us to request write access for the web service.
Arguments:
-
string
pwId- The pathway identifier.
-
string
description- A description of the modifications.
-
string
gpml- The updated GPML code.
-
integer
revision- The revision number of the version this GPML code was based on. This is used to prevent edit conflicts in case another client edited the pathway after this client downloaded it.
-
string
auth- The authentication info.
-
string
username- The username.
createPathway
Create a new pathway on the wiki with the given GPML code.
Note: To create/modify pathways via the web service, you need to have an account with web service write permissions. Please contact us to request write access for the web service.
Arguments:
-
string
gpml- The GPML code.
-
string
auth- The authentication info.
-
string
username- The username.
findPathwaysByText
Find pathways using a textual search on the description and text labels of the pathway objects. The query syntax offers several options:
- Combine terms with AND and OR. Combining terms with a space is equal to using OR ('p53 OR apoptosis' gives the same result as 'p53 apoptosis').
- Group terms with parentheses, e.g. '(apoptosis OR mapk) AND p53'
- You can use wildcards * and ?. * searches for one or more characters, ? searchers for only one character.
- Use quotes to escape special characters. E.g. '"apoptosis*"' will include the * in the search and not use it as wildcard.
Example: http://webservice.wikipathways.org/findPathwaysByText?query=apoptosis
Arguments:
-
string
query- The search query (e.g. 'apoptosis' or 'p53').
-
string
species- The species to limit the search to (leave blank to search on all species).
findPathwaysByXref
Find pathways by searching on the external references of DataNodes (gene/protein/metabolite identifiers). You can specify multiple ids
and codes
parameters to query for multiple xrefs at once. In that case, the number of ids
and codes
parameters should match, they will be paired to form xrefs, e.g.: http://www.wikipathways.org/wpi/webservice/webservice.php/findPathwaysByXref?ids=1234&ids=ENSG00000130164&codes=L&codes=En
Example: http://webservice.wikipathways.org/findPathwaysByXref?ids=1234&codes=L
Arguments:
-
array of string
ids- One or more DataNode identifier(s) (e.g. 'P45985').
-
array of string
codes- One or more code(s) of the database system to limit the search to. See this page for an overview of available system codes. If you supply multiple codes, the number of codes needs to equal the number of ids supplied. If you supply multiple ids and only one code, this code will be used for all ids.
findInteractions
Find interactions defined in WikiPathways pathways.
Example: http://webservice.wikipathways.org/findInteractions?query=P53
Arguments:
-
string
query- The name of an entity to find interactions for (e.g. 'P53')
saveCurationTag
Apply a curation tag to a pahtway. This operation will overwrite any existing tag with the same name.
Note: To create/modify pathways via the web service, you need to have an account with web service write permissions. Please contact us to request write access for the web service.
Arguments:
-
string
pwId- The pathway identifier.
-
string
tagName- The name of the tag to apply.
-
string
tagText- The tag text (optional).
-
integer
revision- The revision this tag applies to.
-
string
auth- The authentication info.
-
string
username- The username.
removeCurationTag
Remove a curation tag from a pathway.
Note: To create/modify pathways via the web service, you need to have an account with web service write permissions. Please contact us to request write access for the web service.
Arguments:
-
string
pwId- The pathway identifier.
-
string
tagName- The name of the tag to remove.
-
string
auth- The authentication info.
-
string
username- The username.
getCurationTags
Get all curation tags for the given pathway.
Example: http://webservice.wikipathways.org/getCurationTags?pwId=WP4
Arguments:
-
string
pwId- The pathway identifier.
getCurationTagsByName
Get all curation tags for the given tag name. Use this method if you want to find all pathways that are tagged with a specific curation tag.
Example: http://webservice.wikipathways.org/getCurationTagsByName?tagName=Curation:FeaturedPathway
Arguments:
-
string
tagName- The tag name (see Special:SpecialCurationTags for an overview of available tag names).
getColoredPathway
Get a colored image version of the pathway.
Arguments:
-
string
pwId- The pathway identifier.
-
integer
revision- The revision number of the pathway (use '0' for most recent version).
-
array of string
graphId- An array with GraphIds of the objects to color.
-
array of string
color- An array with colors of the objects (should be the same length as graphId).
Colors should be encoded as a hexadecimal number, e.g. FF0000 for red).
-
string
fileType- The image type (One of 'svg', 'pdf' or 'png').
getXrefList
Get a list of external references on the pathway (gene, protein or metabolite ids), translated to the given database system.
Example: http://webservice.wikipathways.org/getXrefList?pwId=WP4&code=S
Arguments:
-
string
pwId- The pathway identifier.
-
string
code- The code of the system to translate to (e.g. 'S' for UniProt).
findPathwaysByLiterature
Find pathways by their literature references.
Example: http://webservice.wikipathways.org/findPathwaysByLiterature?query=18651794
Arguments:
-
string
query- The query, can be a pubmed id, author name or title keyword.
saveOntologyTag
Add a specific ontology tag to a given pathway.
Arguments:
-
string
pwId- The pathway identifier
-
string
term- The ontology term
-
string
termId- The ontology term identifier
-
string
auth- The authentication info.
-
string
user- The username of the WikiPathways account
removeOntologyTag
Remove a specific ontology tag to a given pathway.
Arguments:
-
string
pwId- The pathway identifier
-
string
termId- The ontology term identifier
-
string
auth- The authentication info.
-
string
user- The username of the WikiPathways account
getOntologyTermsByPathway
Get ontology terms for a pathway
Example: http://webservice.wikipathways.org/getOntologyTermsByPathway?pwId=WP4
Arguments:
-
string
pwId- The pathway identifier
getPathwaysByOntologyTerm
Get a list of pathways tagged with a given ontology term.
Example: http://webservice.wikipathways.org/getPathwaysByOntologyTerm?term=DOID:344
Arguments:
-
string
term- The ontology term identifier.
getPathwaysByParentOntologyTerm
Get a list of pathways tagged with any ontology term that is the child of the given Ontology term.
Example: http://webservice.wikipathways.org/getPathwaysByParentOntologyTerm?term=DOID:344
Arguments:
-
string
term- The ontology term identifier.
getUserByOrcid
Get WP username by ORCID id.
Arguments:
-
string
orcid- The ORCID identifier.
GPML Elements
Relevant attributes and elements defined for the GPML pathway file format. Also see complete GPML documentation.
GraphId
Internal identifier for datanodes used to define graph model in GPML. The GraphID is a randomly generated hexidecimal. See sample GPML below:
<DataNode TextLabel="HTR1B" Type="Protein" GraphId="c8d79">