Skip to content

REST API

Andrew McLees edited this page Nov 17, 2017 · 5 revisions

PRISM REST API

Guidelines

  • Assume no parameters unless specified
  • No parameters are optional unless specified
  • All REST API calls require the user to be authenticated with passport beforehand.
  • When an object is returned it is returned as JSON in the response body

HTTP Response/Error Code List

The following codes will apply to all endpoints.

Code Meaning
200 (OK) The request completed successfully
201 (CREATED) The entity was created successfully
204 (NO CONTENT) The request completed but returned no content
304 (NOT MODIFIED) The resource was not modified
400 (BAD REQUEST) There is something wrong with the request data
401 (UNAUTHORIZED) The request has no or invalid authentication data
403 (FORBIDDEN) The request's authorized user does not have access to the resource
404 (NOT FOUND) The resource at the location specified does not exist
405 (METHOD NOT ALLOWED) The HTTP method used is not valid for the location specified
5xx (SERVER ERROR) The server had an error processing the request

Where possible, endpoints will also respond with JSON errors according to the format below.

{
  "code": <specific code>,
  "message": "<human readable message>"
}

Reviews

Relevant Objects

Review

Sample Object

{
  "id": "8858d7a5c8d39c20163317fa5",
  "program": "5858d7a5c8d39c20163317fa5",
  "startDate": "2017-09-01",
  "endDate": "2018-05-01",
  "documents": ["8248d7a5c8d39c20163317fa5", "8498d7a5c8d39c20163317fa5"]
}

Create Review

POST /reviews

Creates a new review.

Sample JSON Input

All JSON parameters are optional except program.

{
  "program": "5858d7a5c8d39c20163317fa5",
  "startDate": "2017-09-01",
  "endDate": "2018-05-01"
}

Authorized Users

  • Administrators

Get Review

GET /reviews/{review id}

Gets a review by id. Returns a Review object.

Authorized Users

  • Dean of the college of the review
  • Chair of the department of the review
  • All PRS members
  • Administrators

Get Reviews

GET /reviews

Gets the header information all reviews that the user would have permission to get by specifying its review id.

Response

{
  "reviews": [
    {
      "id": "8858d7a5c8d39c20163317fa5",
      "program": "5858d7a5c8d39c20163317fa5",
      "startYear": "2017",
      "endYear": "2018"
    }
  ]
}

Authorized Users

  • All authenticated users except external reviewers

Add document

POST /reviews/{review id}/add-document/{document title}

Adds a new non-standard document to the review.

Authorized Users

  • Administrators
  • Lead reviewers

Delete Review

DELETE /reviews/{review id}

Deletes a review by id.

Authorized Users

  • Administrators