Coronavirus (Covid-19): Latest updates and information
Skip to main content Skip to navigation

Create an attachment

Create a new attachment that can be attached to (e.g) a submission.

Permission requirements

There are no permission requirements for uploading an attachment, as long as the user is authenticated.

Information about API permissions

Definition

POST https://tabula.warwick.ac.uk/api/v1/attachments

The request Content-Type should be set to the MIME type of the uploaded file

Request parameters

The body of the request should contain the file itself. This should not be wrapped in a multipart form submission or any other kind of encoding.

The filename of the attachment is required, and must be provided either as a filename query parameter on the request, or an X-Filename HTTP request header.

Example request

POST https://tabula.warwick.ac.uk/api/v1/attachments?filename=My+coursework.docx

Response parameters

An unsuccessful response will be returned in the standard format. A successful response will return the HTTP code 201 Created. The Location header will be the API endpoint of the individual attachment and the JSON metadata of the uploaded attachment, with the following parameters:

success Boolean true
status The string "ok"
attachment A file attachment object representing the attachment

Example response

{
  "success": true,
  "status": "ok",
  "attachment": {
    "id": "d91cf0be-9770-4150-9288-848df72fb14a",
    "name": "My coursework.docx",
    "temporary": true,
    "hash": "b2dbde870b92a43d78dddf47d359e052d67c9378",
    "uploadedBy": "in-matmannion-tabula-api",
    "dateUploaded": "2015-11-06T14:23:59Z"
  }
}

Tabula API Methods