REST API

109 views
Skip to first unread message

Juan Carlos Prieto

unread,
Oct 12, 2016, 4:15:54 PM10/12/16
to xnat_discussion
Is there a list or an automatic way to generate the documentation for the REST api? 
I would like to write my own javascript plugin using node to submit and retrieve dicom images to XNAT server. 

Herrick, Rick

unread,
Oct 12, 2016, 5:17:41 PM10/12/16
to xnat_di...@googlegroups.com

The new XAPI REST calls in XNAT 1.7 are documented with Swagger, so they’re fairly easy to discover. This is any call that starts with “/xapi”. You can find them on a 1.7 instance at the URL:

 

http://server/xapi/swagger-ui.html

 

That said, most of the DICOM import and retrieve REST API functions are in our older format, which has no discovery mechanism other than “looking at the code and figuring out the mapping”, which is difficult to automate with node. We’ll be working over the next months to get much of the REST API moved into the new framework and/or provide some way to discover the existing REST API, but until then any code addressing that REST API needs to be written manually.

 

-- 

Rick Herrick

Sr. Programmer/Analyst

Neuroinformatics Research Group

Washington University School of Medicine

--
You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xnat_discussi...@googlegroups.com.
To post to this group, send email to xnat_di...@googlegroups.com.
Visit this group at https://groups.google.com/group/xnat_discussion.
For more options, visit https://groups.google.com/d/optout.

 


The materials in this message are private and may contain Protected Healthcare Information or other information of a sensitive nature. If you are not the intended recipient, be advised that any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited. If you have received this email in error, please immediately notify the sender via telephone or return mail.

John Flavin

unread,
Oct 13, 2016, 9:54:52 AM10/13/16
to xnat_discussion
Note that the Swagger page Rick mentioned (http://{xnat}/xapi/swagger-ui.html) is a human-friendly HTML form. Nice, but not something you'd want to feed to node. For a script-friendly json representation of REST API, use http://{xnat}/xapi/v2/api-docs. Again, though, that will only tell you about the parts of the REST API that we've done in the new style in 1.7, not the older stuff.

Flavin

Juan Carlos Prieto

unread,
Oct 13, 2016, 11:58:26 AM10/13/16
to xnat_discussion
Thank you that is exactly what I was looking for. 

Additionally, could you please point me to “looking at the code and figuring out the mapping” to discover the upload/download of DICOM images? 

Best

Herrick, Rick

unread,
Oct 13, 2016, 12:02:05 PM10/13/16
to xnat_di...@googlegroups.com

Have a look at the code in this class:

 

https://bitbucket.org/nrg/xnat_builder_1_6dev/src/ba064dbb3da4f0f455dfbbb16936dfc739cc807b/plugin-resources/webapp/xnat/java/org/nrg/xnat/restlet/XNATApplication.java?at=default&fileviewer=file-view-default

 

That has most of the REST calls mapped in a form like this:

 

attachArchiveURI(router, "/projects/{PROJECT_ID}/experiments", ProjSubExptList.class);

 

That class does also include some classes from this folder:

 

https://bitbucket.org/nrg/xnat_builder_1_6dev/src/ba064dbb3da4f0f455dfbbb16936dfc739cc807b/plugin-resources/webapp/xnat/java/org/nrg/xnat/restlet/extensions/?at=default

 

Classes in there have an @XnatRestlet annotation that declare their own URL, e.g.:

 

@XnatRestlet({"/services/dicomscp", "/services/dicomscp/{ACTION}"})

 

-- 

Rick Herrick

Sr. Programmer/Analyst

Neuroinformatics Research Group

Washington University School of Medicine

 


Reply-To: "xnat_di...@googlegroups.com" <xnat_di...@googlegroups.com>
Date: Thursday, October 13, 2016 at 10:58 AM
To: "xnat_di...@googlegroups.com" <xnat_di...@googlegroups.com>

--

You received this message because you are subscribed to the Google Groups "xnat_discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xnat_discussi...@googlegroups.com.
To post to this group, send email to xnat_di...@googlegroups.com.
Visit this group at https://groups.google.com/group/xnat_discussion.
For more options, visit https://groups.google.com/d/optout.

Hakim Achterberg

unread,
Oct 21, 2016, 7:52:55 AM10/21/16
to xnat_discussion
For work on the python module I wrote I use the xnat.xsd (and other schemas) to figure out the data structure. That combined with XNAT REST API Directory gives you a lot of knowledge to figure it out. I occasionally fall back to the source code Rick pointed to, but generally don't need to when using the wiki.
Reply all
Reply to author
Forward
0 new messages