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:
- Download xnat_tools.
- Download this XML file: central_all_OASIS_MRS.xml
- From within the xnat_tools directory, issue this command:
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.