XNAT Docs Index

Related Pages

 Click here to expand...

This documentation is for XNAT versions 1.6.0 - 1.6.5. You can find the latest documentation for XNAT 1.7 at https://xnat.org/documentation

Skip to end of metadata
Go to start of metadata

The XNAT search engine can be queried via the REST API.

First, you will need a sample search xml:

This search queries for all mrSessionData objects that are owned by the CENTRAL_OASIS_CS project or shared into the CENTRAL_OASIS_CS project.

The <root_element_name> determines which data type you are returning. There will be one row per matching entry of this type.

You can add fields from other data types using <search_field> elements. You can put any global complexTypes or elements
into the element_name. The field_ID must match a <DisplayField> in the display documents for that data-type.

The search criteria can reference either display fields from the display documents, or schema fields themselves using XPATH.

You can retrieve the search results for this search by POSTing this document to HOST/data/archive/search. You can customize the
format of the results using the format=xml,csv,html,json querystring variable. The xml can be posted in the BODY of your HTML
message, or attached as a seperate file.

To test this:

Here is a second, more interesting search, which gets all of the MR sessions which your account has access to WHERE the DERIVED_AGE is > 90 and the session contains at least one MPRAGE scan: central_all_sessions_with_MPRAGE_by_type.xml

For a list of the available data types you can use in your searches, use this query.

Using the returned complexType names, you can retrieve the fields for the data types of interest.