Last updated: April 14th, 2023
The NDEx 2.5 API is the currently supported REST API and is available at https://www.ndexbio.org.
The older v1.3 API is deprecated and we strongly encourage you to migrate your applications to use the latest version.
The non-secure "http" protocol is also deprecated and we will stop supporting it soon.
Networks sent or received using this API are in CX format. Conversion between CX and other formats is intended to be handled by separate services or libraries. The CX format is described in the CX Data Model document available on this website.
For most purposes, developers are advised to use client libraries that provide convenient access to commonly methods, especially those for network I/O, search, and query.
For advanced applications that attempt to manage users, groups, permissions, tasks, and requests, the NDEx team would like to work with you, initially using our TEST SERVER.
Available Libraries:
For links to code repositories, tutorials and other technical documentation, please refer to the DEVELOPER'S README!!! page.
1 – All the synchronized (blocking) functions use these conventions:
a. Creation: API functions that create resource objects in NDEx server
i. HTTP Method: POST
ii. HTTP return code: 201 on success.
iii. Location field will be populated with the relative url for retrieving the newly created object.
iv. The body of the return is the full URI of the created object.
b. Update: API functions that modify existing resource objects in NDEx server
i. HTTP Method: PUT
ii. HTTP return code: 204 on success
c. Deletion: API functions that delete resource objects in NDEx server
i. HTTP Method: DELETE
ii. HTTP return code: 204 on success
d. Query/retrieval:
i. In general, functions that query or retrieve information from the NDEx server use GET.
ii. For Batch retrieval of resource objects and search functions, we use POST method.
2 – Asynchronized (non-blocking) functions use this convention:
a. Return code: 202 on success
b. “Location” field in the response header will be populated with the relative URL of the task object.
3 – Functions that can potentially return large amount of data provide optional parameters “start” and “size” in their URLs to support paging in client applications.
a. start=n specifies that the result is the nth page of the requested data. The default value is 0.
b. size=n specifies the number of data items in each page. The default value is 100.
4 – Authentication:
a. The public NDEx server supports BASIC AUTH as the authentication method.
b. In this API document, “Authentication: Not required” means the function returns the same result regardless of whether BASIC AUTH credentials are provided in the request or whether the credential are successfully authenticated.
c. “Authentication: Required” means that the request must provide BASIC AUTH credentials that are successfully authenticated. Otherwise a 401 UNAUTHORIZED code will be returned.
d. “Authentication: Optional” means the API function supports both authenticated and anonymous requests, but the result of the function may be different for authenticated requests vs. anonymous requests.
e. Some of the GET functions in the Network Category supports an optional parameter called accessKey. This accessKey allows users to bypass the authentication and have the read access to that resource directly. The network accessKey can be turned on and off using the function "Disable/enable Access Key on Network".
f. The NDEx server also supports Google OAuth as another authentication method. To use Google OAuth:
i. Get an ID_token from Google in your program and add the ID_token string to the Authorization header in your HTTP calls.
ii. The format of your Authorization value is ‘Bearer id_token_string’
iii. Please Contact Us to register your application and obtain the required client ID.
5 – Errors:
a. Unless otherwise stated, NDEx API functions return an HTTP return code 4xx or 500 on errors.
b. The body of these error responses are a json value that includes the error message from the server.
/admin/status?format={full|standard}
Method: GET
Authentication: Not required
Get the current status of the server. Use this function to check if the server is running and which version it is. The default value for parameter format is ‘standard’.
An example of returned object:
{ "networkCount": 1321, "userCount": 12, "groupCount":0, "message":"Online", "properties": { "ServerVersion":"2.1", "ServerResultLimit":"10000" } }
/user/{userid}/membership?groupid={groupid}
Method: GET
Authentication: Required
Description:
/user/{userid}/membership?type={membershiptype}&start={startPage}&size={pageSize}
Method: GET
Authentication: Optional
Description:
/user/{userid}/permission?networkid={networkId}&directonly={true|false}
Method: GET
Authentication: Required
Description:
/user/{userid}/networksummary?offset={offset}&limit={limit}
Method: GET
Authentication: Required
Description:
/user/{userid}/networksets?offset={offset}&limit={limit}&summary={true|false}&showcase={true|false}
Method: GET
Authentication: Not required
Description: Get a list of network sets that are owned by a user.
Parameters:
/group
Method: POST
Authentication: required
Description:
{ "properties": {}, "groupName": "Melanoma Group", "image": “https://example.com/image/group1.jpg”, "website": "ucsd.edu", "description": "description of group" }
/group/{groupid}
Method: PUT
Authentication: required
Description:
/group/{groupid}
Method: DELETE
Authentication: required
Description:
/group/{groupid}
Method: GET
Authentication: Not required
Description:
Attribute | Data type | Description |
externalId | string | uuid of this group. |
groupName | string | A short name of this group |
creationTime | Timestamp | Time when this group was created in NDEx |
modificationTime | Timestamp | Time when this group was last modified. |
properties | object | Properties of of this group. |
image | string | URL of this group’s image. |
website | string | URL of this group’s web site |
description | string | Short description of this group. |
/group/{groupid}/membership?userid={userid}&type={GROUPADMIN|MEMBER}
Method: PUT
Authentication: required
Description:
/group/{groupid}/membership?userid={userid}
Method: DELETE
Authentication: Required
Description:
/group/{groupid}/membership?type={membershiptype}&start={startPage}&size={pageSize}
Method: GET
Authentication: Optional
Description:
Attribute | Data type | Description |
permissions | string | Type of membership a user has. Should be one of these values: “GROUPADMIN” or “MEMBER”. |
memberUUID | string | Uuid of this member |
resourceUUID | string | Uuid of this group |
modificationTime | Timestamp | Time when this group was last modified. |
memberAccountName | string | userName of the member |
resourceName | string | Name of the group |
/group/{groupid}/permission?permission={permission}&start={startPage}&size={pageSize}
Method: GET
Authentication: Optional
Description:
/group/{groupid}/permission?networkid={networkid}
Method: GET
Authentication: Required
Description :
/task?status={status}&start={startPage}&size={pageSize}
Method: GET
Authentication: Required
Description:
Attribute | Data type | Description |
externalId | string | uuid of this task. |
creationTime | Timestamp | Time when this task was created in NDEx |
modificationTime | Timestamp | Time when this task was last modified. |
attributes | object | Additional attributes of of this task. |
format | string | Format of the exported file if this is a network export task. |
description | string | Short description of this task |
taskType | string | Type of this task |
status | string | Status of this task |
taskOwnerId | string | UUID of this task’s owner |
message | string | Error message if this task failed. |
resource | uuid | UUID of the resource which this task operates on. |
startTime | Timestamp | Time when this task started running |
finishTime | Timestamp | Time when this task stopped running |
/task/{taskid}
Method: GET
Authentication: Required
Description:
/task/{taskid}/file?download=true
Method: GET
Authentication: Required
Description:
/task/{taskid}
Method: DELETE
Authentication: Required
Description:
/network?visibility=PRIVATE|PUBLIC
Method: POST
Authentication: Required
Description:
/network/{networkid}
Method: PUT
Authentication: required
Description:
/network/{networkid}
Method: DELETE
Authentication: Required
Description:
/network/{networkid}/summary?accesskey={accessKey}
Method: Get
Authentication: Optional
Description:
Attribute | Datatype | Description |
name | string | Name or title of the network, not unique, same meaning as dc:title |
description | string | Text description of the network, same meaning as dc:description |
creationTme | timeStamp | Time at which the network was created |
modificationTime | timeStamp | Time at which the network was last modified |
visibility | string | One of PUBLIC, PRIVATE. PUBLIC means it can be found or read by anyone, including anonymous users. PRIVATE is the default, means that it can only be found or read by users according to their permissions. |
version | string | Format is not controlled but best practice is to use string conforming to Semantic Versioning. |
nodeCount | integer | the number of node objects in the network |
edgeCount | integer | the number of edge objects in the network |
properties | list | List of NDExPropertyValuePair objects: describes properties of the network. |
externalId | string | Uuid of this network |
ownerUUID | string | Uuid of this networks owner |
isReadOnly | boolean | True if this network is marked as readonly in NDEx. |
subnetworkIds | list | List of integers which are identifiers of subnetworks. |
errorMessage | string | If this network is not a valid CX network, this field holds the error message produced by the CX network validator. |
isValid | boolean | True if this network is a valid CX network. |
owner | string | userName of the network owner. |
indexed | boolean | True if the network needs to be indexed. |
completed | boolean | True means all pending operation on this network has been finished. |
warnings | list of string | If there are potential errors in the network, this field holds the warning message produced by the CX network validator. |
isShowcase | boolean | True if this network is showcased in the owner’s account. |
isCertified | boolean | True if this is a published network in NDEx, with a DOI assigned and a valid publication reference. |
hasLayout | boolean | True if the network has coordinates on its nodes. |
hasSample | boolean | True if the network has a sample network. |
/network/{networkid}?accesskey={accessKey}
Method: GET
Authentication: Optional
Description:
/network/{networkId}/systemproperty
Method: PUT
Authentication: Required
Description:
/network/{networkid}/sample?accesskey={accessKey}
Method: GET
Authentication: Optional
Description:
/network/{networkid}/sample
Method: PUT
Authentication: Required
Description:
/network/{networkid}/profile
Method: PUT
Authentication: Required
Description:
/network/{networkid}/properties
Method: PUT
Authentication: Required
Description:
Attribute | Datatype | Description |
subNetworkId | string | Identifier of the subnetwork to which the property applies. |
predicateString | string | Name of this property |
dataType | string | Data type of this property. Its value has to be one of the attribute data types that CX supports. |
value | string | A string representation of the property value. |
/network/{networkid}/provenance?accesskey={accessKey}
Method: GET
Authentication: Optional
Description:
/network/{networkid}/provenance
Method: PUT
Authentication: Required
Description:
/network/{networkid}/aspect?accesskey={accessKey}
Method: GET
Requires Authentication: Optional
Description:
/network/{networkid}/aspect/{aspectName}/metadata
Method: GET
Requires Authentication: Optional
Description:
/network/{networkid}/aspect/{aspectName}?size={limit}
Method: GET
Requires Authentication: Optional
Description:
/network/{networkid}/aspects
Method: PUT
Authentication: Required
Description:
/network/{networkid}/copy
Method: POST
Authentication: Required
Description: This function clones the network specified by networkid to the signed in user’s account. It returns the URL of cloned network to the client.
/network/{networkid}/summary
Method: PUT
Authentication: Required
Description: This function uses the name,description, version, visibility and properties fields in the payload to overwrite the corresponding fields of the given network on server.
/network/{networkid}/accesskey
Method: GET
Authentication: Required
Description: This function returns an access key to the user. This access key will allow any user to have read access to this network regardless if that user has READ privilege on this network.
/network/{networkid}/accesskey?action=disable|enable
Method: PUT
Authentication: Required
Description: This function turns off/on the access key. It returns the accessKey if the action=enable and returns nothing when action is disable. The caller has to be the owner of this network.
Each network sets is owned by a user.
/networkset
Method: POST
Authentication: Required
Description: Create a network set. The posted object should have these 2 fields:
/networkset/{networksetid}
Method: PUT
Authentication: Required
Description:
{ “name”: string, “description”: string}
/networkset/{networksetid}
Method: DELETE
Authentication: Required
Description: Deletes a network set.
/networkset/{networksetid}?accesskey={accesskey}
Method: GET
Authentication: Not required
Description:
{ “name”: string, “description” : string, “Networks”: [ network_ids] }
/networkset/{networksetid}/members
Method: POST
Authentication: Required
Description: Add a list of networks to this set. The posted data is a list of network ids. All the networks should be visible to the owner of network set.
/networkset/{networksetid}/members
Method: DELETE
Authentication: Required
Description: Delete networks from a networks set. Posted data is a list of network ids.
/networkset/{networksetId}/systemproperty
Method: PUT
Authentication: Required
Description:
{property: value}
such as { “showcase”: true}
/batch/user
Method: POST
Authentication: Not required
Description:
/batch/group
Method: POST
Authentication: Not required
Description:
/batch/network/summary?accesskey={accessKey}
Method: POST
Authentication: Optional
Description:
/batch/network/permission
Method: POST
Authentication: Required
Description:
/batch/network/export
Method: POST
Authentication: Required
Description:
{
“exportFormat”: “GSEA Gene Set”,
“networkIds”: a list of network UUIDs
}
/search/user?start={number}&size={number}
Method: POST
Authentication: Optional
Description:
/search/group?start={number}&size={number}
Method: POST
Authentication: None
Description:
/search/network?start={number}&size={number}
Method: POST
Authentication: Optional
Description:
searchString | Required. A whitespace-delimited string that is handled according to Lucene search string protocol. |
permission | Optional. By default, this parameter is not set, meaning that there is no filtering of networks based on permission. If this parameter is set, it must be either ‘WRITE’ or ‘READ’.
If set to ‘WRITE’, the search will only return networks for which the authenticated user has edit or admin permission. If set to READ, the search will only return networks for which the authenticated user has edit, admin, or read permission. Note that this only includes networks that are readable due to explicit permission, not networks that are readable because they have been made PUBLIC. |
includeGroups | Optional. Boolean value, defaults to false.
If includeGroups is true, the search will also return networks based on permissions from the authenticated user’s group memberships. This enables search to return a network where a group has permission to access the network and the user is a member of the group. |
accountName | Optional. String value. If the accountName parameter is provided, then the search will be constrained to networks owned by that account. |
/search/network/{networkid}/query?save={true|false}
Method: POST
Authentication: Optional
Description:
searchString | A whitespace delimited string of search terms which are matched vs. (1) the controlled vocabulary terms used in the network and (2) names of nodes in the network. A set of initial nodes is selected based on association with matched terms or simple name match. The query selects edges based on traversal from those initial nodes. |
searchDepth | Integer value between 1 and 3. Sets the maximum number of traversal steps from the initial nodes. Default value is 1. If the searchDepth is less than 1, the server will do a 1 step search. |
edgeLimit | Maximum number of edges that this query can return. Default value is 0. A negative or zero edgeLimit means no limit in the query. |
errorWhenLimitIsOver | Default value is true. If this value is true the server will stop streaming the network when it hits the edgeLimit, add success: false and error: "EdgeLimitExceeded" in the status aspect and close the CX stream. If this value is set to false the server will return a subnetwork with edge count up to edgeLimit. The status aspect will be a success, and a network attribute {"EdgeLimitExceeded": "true"} will be added to the returned network only if the server hits the edgeLimit. |
directOnly | Default value is false, which means full neighborhood will be returned. When this parameter is set to true, the server will perform an Adjacent query, which means edges between n-th step neighbor vertex will be excluded from the result. |
/search/network/{networkid}/interconnectquery?save={true|false}
Method: POST
Authentication: Optional
Description:
searchString | A whitespace delimited string of search terms which are matched vs. (1) the controlled vocabulary terms used in the network and (2) names of nodes in the network. A set of initial nodes is selected based on association with matched terms or simple name match. The query selects edges based on traversal from those initial nodes. |
searchDepth | Integer value between 1 and 2. Sets the maximum number of traversal steps from the initial nodes. Default value is 1. If the searchDepth is less than 1, the server will do a 1 step search. If you want to run a Interconnect query described in NDEx web app, set this value to 2. If you want to run a Direct query, set this value to 1. |
edgeLimit | Maximum number of edges that this query can return. Default value is 0. A negative or zero edgeLimit means no limit in the query. |
errorWhenLimitIsOver | Default value is true. If this value is true the server will stop streaming the network when it hits the edgeLimit, add success: false and error: "EdgeLimitExceeded" in the status aspect and close the CX stream. If this value is set to false the server will return a subnetwork with edge count up to edgeLimit. The status aspect will be a success, and a network attribute {"EdgeLimitExceeded": "true"} will be added to the returned network only if the server hits the edgeLimit. |
/search/network/genes?start={number}&size={number}
Method: POST
Authentication: Optional
Description:
searchString |
Required. A whitespace-delimited or comma-delimited string that each term is a gene symbol or identifier. This search function will expend each term to it’s alias, NCBI gene ID, Uniprot IDs, ensembl gene ID, and HGNC ID using gene query service at Mygene.Info. |
searchString | Required. A whitespace-delimited string that is handled according to Lucene search string protocol. |
permission | Optional. By default, this parameter is not set, meaning that there is no filtering of networks based on permission. If this parameter is set, it must be either ‘WRITE' or ‘READ'. If set to ‘WRITE', the search will only return networks for which the authenticated user has edit or admin permission. If set to READ, the search will only return networks for which the authenticated user has edit, admin, or read permission. Note that this only includes networks that are readable due to explicit permission, not networks that are readable because they have been made PUBLIC. |
includeGroups | Optional. Boolean value, defaults to false. If includeGroups is true, the search will also return networks based on permissions from the authenticated user's group memberships. This enables search to return a network where a group has permission to access the network and the user is a member of the group. |
accountName | Optional. String value. If the accountName parameter is provided, then the search will be constrained to networks owned by that account. |
Note that in v1.3, the "canRead" parameter documented in v1.2 is no longer supported because it was only needed for the discontinued "DISCOVERABLE" network visibility status.
Examples of search strings:
pancreatic
Simple search term. Finds networks in which any indexed term is the string "pancreatic".
panc*
Wildcarding with "*". Find networks in which any indexed field starts with "panc"
description:cancer
Search by field. Find networks in which a specific field – "description" – matches "cancer"
nodeCount:[5 TO 70]
Find networks with field nodeCount in specified range
nodeCount:[5 TO 70] AND panc*
Boolean combination of search strings using AND. Finds networks satisfying both search criteria.
Java Client Methods:
public List<NetworkSummary> findNetworks(
String searchString,
boolean canRead,
String accountName,
int skipBlocks,
int blockSize)
public List<NetworkSummary> findNetworks(
String searchString,
boolean canRead,
String accountName,
Permissions permissionOnAcc, boolean includeGroups,
int skipBlocks,
int blockSize)
GET : /network/{networkId}/provenance
This method retrieves the ‘provenance' attribute of the network specified by ‘networkId', if it exists. The returned value is a JSON ProvenanceEntity object which in turn contains a tree-structure of ProvenanceEvent and ProvenanceEntity objects that describe the provenance history of the network. See the document NDEx Provenance History for a detailed description of this structure and best practices for its use.
Java Client Method:
public ProvenanceEntity getNetworkProvenance(String networkId)
PUT : /network/{networkId}/provenance
Requires Authentication
Updates the ‘provenance' field of the network specified by ‘networkId' to be the ProvenanceEntity object in the PUT data. The ProvenanceEntity object is expected to represent the current state of the network and to contain a tree-structure of ProvenanceEvent and ProvenanceEntity objects that describe the networks provenance history.
Java Client Method:
public ProvenanceEntity setNetworkProvenance(
String networkId,
ProvenanceEntity provenance)
GET : /network/{networkId}/asCX
This method retrieves all CX aspects of the entire network specified by ‘networkId' as a CX stream. This is performed as a monolithic operation, so care should be taken when requesting very large networks. Applications can use the getNetworkSummary method to check the node and edge counts for a network prior to making the request, but with the advent of CX, it is also possible for a client to read incrementally and abort the operation if the in-memory structures become too large. As an optimization, networks that are designated read-only (see Make a Network Read-Only) are cached by NDEx for rapid access.
Java Client Method:
public InputStream getNetworkAsCXStream(String id)
POST : /network/asCX
Requires Authentication
This method creates a new network on the NDEx Server based on a POSTed InputStream object. An error is returned if the stream is not provided or if the CX data does not specify a name attribute. An error is also returned if the number of elements in the CX stream is larger than a maximum size for network creation set in the NDEx server configuration. The UUID for the new network is returned.
Java Client Method:
public UUID createCXNetwork(InputStream cxStream)
PUT : /network/asCX
Requires Authentication
This method updates an existing network with new content. The method takes a network UUID and a CX Stream the PUT data. This method errors if the stream or network UUID is not provided or if the UUID does not correspond to an existing network on the NDEx Server. It also errors if the number of CX elements is larger than a maximum size for network creation set in the NDEx server configuration. The UUID corresponding to the updated network is returned.
Java Client Method:
public UUID updateNetwork(UUID networkId, InputStream cxStream)