Home » Tutorials »  NIF REST Sevces - Federated Data

NIF REST Services - Federated Data

In order to pull information from the NIF federated data sources, follow this three-step procedure.

1. Get a list of all Data Sources

The summary of sources is available at: http://nif-services.neuinfo.org/nif/services/federationSummary
This REST service returns an xml file:

Rest service returns an xml file

Each federated resource has a name, description and <indexable> elements , which lists all the indexed views for a source. 


2. Determine what resource and data you want to access

In order to target data from the Cell Centered Database (CCDB), first locate the federated resource CCDB and the <indexable> elements:
locate the federated resource and indexable elements

CCDB has four different views: "All Information," "Segmentation," "Anatomical Detail," and "Protein Information."


3. Loop through index views and fetch data

To fetch data, use the following URL syntax:

http://neuinfo.org/nif/services/federationQuery/[ResourceName]/[Indexable]?q=[SearchQuery]&count=10&offset=0

*Note: to retrieve all records, use the search query "nifall." Since some of these datasets have a large number of records, be sure to pull the data in batches using the "'count" and "offset" options.  The "count=#" parameter determines how many records will return and the "offset=#" parameter sets the starting point.


Example

To access all the data records from the CCDB and "All Information" indexable, used the following URL:
http://nif-services.neuinfo.org/nif/services/federationQuery/CCDB/All%20Information?q=nifall&count=10&offset=0

*Note: Remember to properly escape spaces. Use a percentage sign (%) to escape spaces.

This will return an xml file containing the first 10 records. The first records are as follows:

xml file of the first 10 records

Notice that the last data element contains an href attribute that links directly to the record on the CCDB Resource. Below is the first data record from our example xml in tabular form:

last data element contains href attribute to CCDB resource

 

More advanced information about NIF REST services can be found in this available WADL file.

NIF Navigator