Skip to main content
Skip table of contents

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.

CODE
GET /data/projects

Parameters:

ParameterDescriptionParameter TypeData Type
formatOptional. Set the format of the response. Format value can be json, html, xml, or csv. If not specified, default is JSONquerystringstring
accessibleOptional. 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.querystringboolean
ownerOptional. Restrict the list of projects to those where the currently logged in user is listed as an owner. Default is false.querystringboolean
memberOptional. Restrict the list of projects to those where the currently logged in user is listed as a member. Default is false.querystringboolean
collaboratorOptional. Restrict the list of projects to those where the currently logged in user is listed as a collaborator. Default is false.querystringboolean
activeSinceOptional. Restrict the list of projects to those who have been updated since the specified date. Date format is YYYY-MM-DDquerystringdate
recentOptional. Restrict the list of projects to those who have been recently accessed by the logged in user. Default is falsequerystringboolean
favoriteOptional. Restrict the list of projects to those in the current user's "favorites" list.querystringboolean

Response:

CODE
[
    { 
        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.

CODE
POST /data/projects

Parameters:

ParameterDescriptionParameter TypeData Type
ModelProject parameters that can be specified in an XML document. Please note that ID, secondary_ID and name are required.Body

XML schema:

  • xnat:projectData/ID
  • xnat:projectData/secondary_ID
  • xnat:projectData/name
  • xnat:projectData/description
  • xnat:projectData/keywords
  • xnat:projectData/alias
  • xnat:projectData/PI/firstname
  • xnat:projectData/PI/lastname
  • xnat:projectData/meta/last_modified
  • xnat:projectData/meta/insert_date
  • xnat:projectData/meta/insert_user

Response Codes:

HTTP Status CodeMessage
201

Project successfully created.

400

The submitted data was invalid.

401

Must be authenticated to access the XNAT REST API.

404

Not Found

409Project already exists
500

An unexpected error occurred.



Get information on a specific project

Returns project metadata for a single project, specified by ID.

CODE
GET /data/projects/{id}

Parameters:

ParameterDescriptionParameter TypeData Type
idProject ID (value of xnat:projectData/ID)pathstring
formatOptional. 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)querystringstring: 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.

CODE
PUT /data/projects/{id}

Parameters:

ParameterDescriptionParameter TypeData Type
idProject ID (value of xnat:projectData/ID)pathstring
Model

Project parameters that can be specified in an XML document, or as values encoded in the querystring. Please note that xnat:projectData/ID cannot be updated on any project.

See: Project Data REST XML Path Shortcuts

Body / querystring

XML schema:

  • xnat:projectData/secondary_ID
  • xnat:projectData/name
  • xnat:projectData/description
  • xnat:projectData/keywords
  • xnat:projectData/alias
  • xnat:projectData/PI/firstname
  • xnat:projectData/PI/lastname
  • xnat:projectData/meta/last_modified
  • xnat:projectData/meta/insert_date
  • xnat:projectData/meta/insert_user

Response Codes:

HTTP Status CodeMessage
200Project successfully updated.
400

The submitted data was invalid.

401Must be authenticated to access the XNAT REST API.
404Not found.
409Request conflicts with existing projects
500An unexpected error occurred.



Delete a project

This operation is permanent and cannot be undone.

CODE
DELETE /data/projects/{id}

Response:

HTTP Status CodeMessage
200

Project deleted.

401Must be authenticated to access the REST API.
404

Not found.

500An unexpected error occurred.




JavaScript errors detected

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

If this problem persists, please contact our support.