Project API
Contents:
Note
A valid CSRF token is required for all PUT, POST and DELETE API calls.
Get a listing of all projects
Returns a listing of all projects in your XNAT.
GET /data/projects
Parameters:
Parameter | Description | Parameter Type | Data Type |
---|---|---|---|
format | Optional. Set the format of the response. Format value can be json, html, xml, or csv. If not specified, default is JSON | querystring | string |
accessible | Optional. Restrict the list of projects to those that are accessible to the currently logged in user. This is a catchall for any project group that the user may be assigned to. Default is false. | querystring | boolean |
owner | Optional. Restrict the list of projects to those where the currently logged in user is listed as an owner. Default is false. | querystring | boolean |
member | Optional. Restrict the list of projects to those where the currently logged in user is listed as a member. Default is false. | querystring | boolean |
collaborator | Optional. Restrict the list of projects to those where the currently logged in user is listed as a collaborator. Default is false. | querystring | boolean |
activeSince | Optional. Restrict the list of projects to those who have been updated since the specified date. Date format is YYYY-MM-DD | querystring | date |
recent | Optional. Restrict the list of projects to those who have been recently accessed by the logged in user. Default is false | querystring | boolean |
favorite | Optional. Restrict the list of projects to those in the current user's "favorites" list. | querystring | boolean |
Response:
[
{
description: "string",
ID: "string",
name: "string",
pi_firstname: "string"
pi_lastname: "string",
secondary_ID: "string",
URI: "path"
}
]
Create one or more projects
This POST form accepts an XML file specifying project parameters. See available project parameters.
POST /data/projects
Parameters:
Parameter | Description | Parameter Type | Data Type |
---|---|---|---|
Model | Project parameters that can be specified in an XML document. Please note that ID , secondary_ID and name are required. | Body | XML schema:
|
Response Codes:
HTTP Status Code | Message |
---|---|
201 | Project successfully created. |
400 | The submitted data was invalid. |
401 | Must be authenticated to access the XNAT REST API. |
404 | Not Found |
409 | Project already exists |
500 | An unexpected error occurred. |
Get information on a specific project
Returns project metadata for a single project, specified by ID.
GET /data/projects/{id}
Parameters:
Parameter | Description | Parameter Type | Data Type |
---|---|---|---|
id | Project ID (value of xnat:projectData/ID ) | path | string |
format | Optional. Set the format of the response. If not specified, HTML for the project report page will be returned (and displayed if using a web browser) | querystring | string: json, html, xml, csv |
Update parameters for a specific project
Allows the user to edit project metadata by passing values through the querystring, or as XML data.
PUT /data/projects/{id}
Parameters:
Parameter | Description | Parameter Type | Data Type |
---|---|---|---|
id | Project ID (value of xnat:projectData/ID ) | path | string |
Model | Project parameters that can be specified in an XML document, or as values encoded in the querystring. Please note that | Body / querystring | XML schema:
|
Response Codes:
HTTP Status Code | Message |
---|---|
200 | Project successfully updated. |
400 | The submitted data was invalid. |
401 | Must be authenticated to access the XNAT REST API. |
404 | Not found. |
409 | Request conflicts with existing projects |
500 | An unexpected error occurred. |
Delete a project
This operation is permanent and cannot be undone.
DELETE /data/projects/{id}
Response:
HTTP Status Code | Message |
---|---|
200 | Project deleted. |
401 | Must be authenticated to access the REST API. |
404 | Not found. |
500 | An unexpected error occurred. |