Project User Access API
A CSRF Token may be required for all PUT, POST and DELETE calls, depending on your Admin UI setting.
Get A List Of Users Associated With A Project
GET - /data/projects/{PROJECT_ID}/users
Parameters:
{PROJECT_ID} | Path parameter – the project ID |
---|---|
format | Optional querystring parameter:
|
Response: (CSV format)
For a test project with project ID "UXE", the groups "UXE_owners", "UXE_members" and "UXE_collaborators" are created by default. In addition, a custom group named "UXE_Reviewers" was also created and has users associated with it.
GROUP_ID, displayname, login, firstname, lastname, email
UXE_Reviewers, Reviewers, uxeNycOwner, Sample, User, xnatselenium@gmail.com
UXE_owner, Owners, owner, Sample, User, xnatselenium@gmail.com
UXE_member, Members, member, Sample, User, xnatselenium@gmail.com
UXE_collab, Collaborators, collaborator, Sample, User, xnatselenium@gmail.com
Add Project Access To A User Account
PUT - /data/projects/{PROJECT_ID}/users/{GROUP_DISPLAY_NAME}/{USERNAME | EMAIL}
Parameters:
{PROJECT_ID} | Path parameter – the project ID |
---|---|
{GROUP_DISPLAY_NAME} | Path parameter – the display name of the access group you want the new user to join (aka "Members") |
{USERNAME} | Optional Path parameter – the XNAT username of the user you want to add |
{EMAIL} | Optional Path parameter – an email of a user you want to invite |
Note: If you specify an email address that does not have an existing user account associated with it, this REST path will create a Project Access Request (PAR) for this project and XNAT will email an invitation to register to that email account. When the recipient registers an account in XNAT and logs in, they will be notified of the project access request and be able to respond.
Response:
Displays an updated list of users
Remove Project Access From A User Account
DELETE - /data/projects/{PROJECT_ID}/users/{GROUP_DISPLAY_NAME}/{USERNAME | EMAIL}
Parameters:
{PROJECT_ID} | Path parameter – the project ID |
---|---|
{GROUP_DISPLAY_NAME} | Path parameter – the display name of the access group you want the new user to join (aka "Members") |
{USERNAME} | Optional Path parameter – the XNAT username of the user you want to remove |
{EMAIL} | Optional Path parameter – an email of a user you want to remove |
Note: You cannot use this method to "uninvite" a user account that has not been registered in XNAT yet. If you want to remove a Project Access Request, see: Project Access Request API