Enable Container Service image via the REST API

46 views
Skip to first unread message

Paul Smith

unread,
Jul 19, 2023, 6:14:51 AM7/19/23
to xnat_discussion
Hi,

I have added a command to the Container Service using the REST API:

curl -u admin  ${XNAT_URL}/xapi/commands/ -H 'Content-Type: application/json'  -d @command.json

I've looked at the docs for the Container Service REST API, but I can't figure out how to enable images (site-wide and for specific projects) using the API. Is it possible to do this?

Also, the rendering of the HTML in the Container Service API docs is a bit strange - there are lots of 'â', '€', and '<' characters.

Thanks,
Paul


John Flavin

unread,
Jul 19, 2023, 10:03:33 AM7/19/23
to xnat_di...@googlegroups.com
Enabling is done through the "Command Configuration" APIs. It's at the top of the swagger page under command-configuration-rest-api. (And I apologize in advance, because this is a pretty rough area of the Container Service's design.)

First, for reference, there are wiki pages describing how to do this through the UI: Enabling Commands and Setting Site-wide Defaults and Enable a Command in Your Project. The API works exactly like the UI does. You can configure a particular command wrapper at either the site or project level—where configuration means setting things like default input values or matchers for things like scan types and so on—and you can enable/disable each wrapper at the site or project level.

To use the configuration APIs you'll need either the wrapper ID of the command wrapper you wish to enable or both the command ID and the wrapper name. 

To enable sitewide, PUT to /xapi/wrappers/${wrapperId}/enabled or /xapi/commands/${commandId}/wrappers/${wrapperName}/enabled.

Similarly, to enable on a project PUT to /xapi/projects/${projectId}/wrappers/${wrapperId}/enabled or /xapi/projects/${projectId}/commands/${commandId}/wrappers/${wrapperName}/enabled.

John Flavin
Backend Team Lead
He/Him



--
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 view this discussion on the web visit https://groups.google.com/d/msgid/xnat_discussion/ecc6cf65-74cb-47fc-9ac1-3789ecb4ef69n%40googlegroups.com.

Paul Smith

unread,
Jul 20, 2023, 3:59:15 AM7/20/23
to xnat_discussion
Thank you so much! That's super helpful.

Thanks,
Paul

Reply all
Reply to author
Forward
0 new messages