Skip to main content
Skip table of contents

Project API

Get a listing of all projects

Returns a listing of all projects in your XNAT.

CODE
GET /data/projects

Parameters:

Parameter

Description

Data Type

format

Optional querystring parameter. Set the format of the response. Format value can be json, html, xml, or csv. If not specified, default is JSON

string

accessible

Optional querystring parameter. 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.

boolean

owner

Optional querystring parameter. Restrict the list of projects to those where the currently logged in user is listed as an owner. Default is false.

boolean

member

Optional querystring parameter. Restrict the list of projects to those where the currently logged in user is listed as a member. Default is false.

boolean

collaborator

Optional querystring parameter. Restrict the list of projects to those where the currently logged in user is listed as a collaborator. Default is false.

boolean

activeSince

Optional querystring parameter. Restrict the list of projects to those who have been updated since the specified date. Date format is YYYY-MM-DD

date

recent

Optional querystring parameter. Restrict the list of projects to those who have been recently accessed by the logged in user. Default is false

boolean

favorite

Optional querystring parameter. Restrict the list of projects to those in the current user's "favorites" list.

boolean

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:

Parameter

Description

Data Type

Model

Project parameters that can be specified in an XML document. Please note that ID, secondary_ID and name are required.

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

XML

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.

CODE
GET /data/projects/{id}

Parameters:

Parameter

Description

Data Type

id

Required path parameter. Project ID (value of xnat:projectData/ID)

string

format

Optional querystring parameter. 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)

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.

CODE
PUT /data/projects/{id}

Parameters:

Parameter

Description

Data Type

id

Required path parameter. Project ID (value of xnat:projectData/ID)

string

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.

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

See: Project Data REST XML Path Shortcuts

XML

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.

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

JavaScript errors detected

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

If this problem persists, please contact our support.