Skip to main content
Skip table of contents

XNAT Workflow API

Workflow Querystring Parameters

These parameters can be used when creating or modifying a workflow entry.

wrk:workflowData/id

The ID of the experiment

wrk:workflowData/launch_time

The launch time of the pipeline.  (Format: "YYYY-MM-DD HH:MM:SS")

wrk:workflowData/data_type

The data type (xsiType) of the experiment. (Required only when adding a new workflow)

wrk:workflowData/pipeline_name

The name of the pipeline or process

wrk:workflowData/status

The status of the workflow (Required only when adding a new workflow)


Create A Workflow Entry From An XML Descriptor File

Note that the specified experiment ID "local_E00106" does not have to exist in your XNAT in order for this workflow entry to be stored. However, any workflow entry with a valid XNAT experiment ID will show up in that experiment's History table.

Workflow Description XML
XML
<wrk:Workflow xmlns:wrk="http://nrg.wustl.edu/workflow"
 ExternalID="PipelineTest"
 ID="local_E00106"
 data_type="xnat:mrSessionData"
 launch_time="2014-02-13T00:50:54"
 pipeline_name="My_Pipeline_Name"
 status="In Progress" />

CODE
PUT - /data/workflows

Parameters

file

Required body or form parameter

?inbody=true

Optional querystring parameter. Use if you are including the file in the body of your request, rather than part of a multi-part form

Response Code:

200

OK

Response: none


Create A New Workflow Entry With Querystring Parameters

CODE
PUT - /data/workflows?wrk:workflowData/id=local_E00106&wrk:workflowData/pipeline_name=My_Pipeline_Name&wrk:workflowData/launch_time=2018-01-01%2000:50:54&wrk:workflowData/data_type=xnat:mrSessionData&wrk:workflowData/status=In%20Progress

Response Code

200

OK

Response: none

Change the Status Of A Workflow Entry

CODE
PUT - /data/workflows/{workflow-id}?wrk:workflowData/status=Failed

Parameters

{workflow-id}

Required path parameter.

wrk:workflowData/status

Required querystring parameter

Response Code

200

OK

Response: none

Get A Workflow Entry By Querystring Parameters

CODE
GET - /data/workflows?wrk:workflowData/id=local_E00106&wrk:workflowData/pipeline_name=My_Pipeline_Name&wrk:workflowData/launch_time=2018-01-01%2000:50:54&wrk:workflowData/data_type=xnat:mrSessionData&wrk:workflowData/status=In%20Progress

Response

CODE
<wrk:Workflow data_type="xnat:mrSessionData" ID="local_E00106" ExternalID="PipelineTest" status="FAILED" pipeline_name="My_Pipeline_Name" launch_time="2014-02-13T00:50:54" xmlns:arc="http://nrg.wustl.edu/arc" xmlns:val="http://nrg.wustl.edu/val" xmlns:pipe="http://nrg.wustl.edu/pipe" xmlns:wrk="http://nrg.wustl.edu/workflow" xmlns:scr="http://nrg.wustl.edu/scr" xmlns:xdat="http://nrg.wustl.edu/security" xmlns:rad="http://nrg.wustl.edu/rad" xmlns:cat="http://nrg.wustl.edu/catalog" xmlns:prov="http://www.nbirn.net/prov" xmlns:xnat="http://nrg.wustl.edu/xnat" xmlns:xnat_a="http://nrg.wustl.edu/xnat_assessments" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://nrg.wustl.edu/workflow http://10.1.1.17/xnat/schemas/workflow.xsd http://nrg.wustl.edu/catalog http://10.1.1.17/xnat/schemas/catalog.xsd http://nrg.wustl.edu/pipe http://10.1.1.17/xnat/schemas/repository.xsd http://nrg.wustl.edu/rad http://10.1.1.17/xnat/schemas/radRead.xsd http://nrg.wustl.edu/scr http://10.1.1.17/xnat/schemas/screeningAssessment.xsd http://nrg.wustl.edu/arc http://10.1.1.17/xnat/schemas/project.xsd http://nrg.wustl.edu/val http://10.1.1.17/xnat/schemas/protocolValidation.xsd http://nrg.wustl.edu/xnat http://10.1.1.17/xnat/schemas/xnat.xsd http://nrg.wustl.edu/xnat_assessments http://10.1.1.17/xnat/schemas/assessments.xsd http://www.nbirn.net/prov http://10.1.1.17/xnat/schemas/birnprov.xsd http://nrg.wustl.edu/security http://10.1.1.17/xnat/schemas/security.xsd">
	<!--hidden_fields[wrk_workflowData_id="530"]-->
</wrk:Workflow>

Note that the returned XML descriptor now has a "hidden field" that displays the workflow ID.


Get A Workflow Entry By ID

CODE
GET - /data/workflows/{workflow-id}

Parameters

{workflow-id}

Required path parameter.

A table of all logged workflows in your XNAT can be found in the XNAT Admin UI. By default, the first column is "Workflow ID"

format

Optional querystring parameter. Format the response object.

  • xml (default)

  • html

  • json

Response

Example workflow entry from an Autorun pipeline execution on a development XNAT VM. 

CODE
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<wrk:Workflow type="PROCESS" category="DATA" data_type="xnat:mrSessionData" ID="XNAT_E00011" ExternalID="BJC_Pat" current_step_launch_time="2018-01-04T16:16:30" current_step_id="LAUNCH_PIPELINES" status="Complete" pipeline_name="xnat_tools/AutoRun.xml" step_description="Launch auto-run pipelines" launch_time="2018-01-04T16:16:14" percentageComplete="100.0" xmlns:arc="http://nrg.wustl.edu/arc" xmlns:val="http://nrg.wustl.edu/val" xmlns:pipe="http://nrg.wustl.edu/pipe" xmlns:wrk="http://nrg.wustl.edu/workflow" xmlns:scr="http://nrg.wustl.edu/scr" xmlns:xdat="http://nrg.wustl.edu/security" xmlns:rad="http://nrg.wustl.edu/rad" xmlns:cat="http://nrg.wustl.edu/catalog" xmlns:prov="http://www.nbirn.net/prov" xmlns:xnat="http://nrg.wustl.edu/xnat" xmlns:xnat_a="http://nrg.wustl.edu/xnat_assessments" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://nrg.wustl.edu/workflow http://10.1.1.17/xnat/schemas/workflow.xsd http://nrg.wustl.edu/catalog http://10.1.1.17/xnat/schemas/catalog.xsd http://nrg.wustl.edu/pipe http://10.1.1.17/xnat/schemas/repository.xsd http://nrg.wustl.edu/rad http://10.1.1.17/xnat/schemas/radRead.xsd http://nrg.wustl.edu/scr http://10.1.1.17/xnat/schemas/screeningAssessment.xsd http://nrg.wustl.edu/arc http://10.1.1.17/xnat/schemas/project.xsd http://nrg.wustl.edu/val http://10.1.1.17/xnat/schemas/protocolValidation.xsd http://nrg.wustl.edu/xnat http://10.1.1.17/xnat/schemas/xnat.xsd http://nrg.wustl.edu/xnat_assessments http://10.1.1.17/xnat/schemas/assessments.xsd http://www.nbirn.net/prov http://10.1.1.17/xnat/schemas/birnprov.xsd http://nrg.wustl.edu/security http://10.1.1.17/xnat/schemas/security.xsd">
    <wrk:executionEnvironment xsi:type="wrk:xnatExecutionEnvironment">
        <wrk:pipeline>xnat_tools/AutoRun.xml</wrk:pipeline>
        <wrk:xnatuser>793aeb08-f225-4bbe-8fa4-8c3b3cf758ba</wrk:xnatuser>
        <wrk:host>http://10.1.1.17/xnat</wrk:host>
        <wrk:parameters>
            <wrk:parameter name="id">XNAT_E00011</wrk:parameter>
            <wrk:parameter name="label">Patient_007382</wrk:parameter>
            <wrk:parameter name="project">BJC_Pat</wrk:parameter>
            <wrk:parameter name="xnat_project">BJC_Pat</wrk:parameter>
            <wrk:parameter name="userfullname">A.Admin</wrk:parameter>
            <wrk:parameter name="supressEmail">false</wrk:parameter>
            <wrk:parameter name="useremail">administrator@xnat.org</wrk:parameter>
            <wrk:parameter name="session">XNAT_E00011</wrk:parameter>
            <wrk:parameter name="xnatserver">XNAT</wrk:parameter>
            <wrk:parameter name="mailhost">localhost</wrk:parameter>
            <wrk:parameter name="sessionType">xnat:mrSessionData</wrk:parameter>
            <wrk:parameter name="adminemail">administrator@xnat.org</wrk:parameter>
            <wrk:parameter name="sessionLabel">Patient_007382</wrk:parameter>
            <wrk:parameter name="workflowid">125</wrk:parameter>
        </wrk:parameters>
        <wrk:notify>administrator@xnat.org</wrk:notify>
        <wrk:dataType>xnat:mrSessionData</wrk:dataType>
        <wrk:id>XNAT_E00011</wrk:id>
        <wrk:supressNotification>1</wrk:supressNotification>
    </wrk:executionEnvironment>
</wrk:Workflow>

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.