Skip to content
This repository has been archived by the owner on Oct 8, 2022. It is now read-only.

Papers Api

Lucas Satabin edited this page Jun 29, 2014 · 8 revisions

Api Summary

Method Path Description
POST /papers Create a new paper
DELETE /papers Delete a paper
GET /papers/<paperid>/info Get the paper data
PATCH /papers/<paperid>/info Modify the paper data
GET /papers/<paperid>/roles Get the paper roles
PATCH /papers/<paperid>/roles Modify the paper roles
GET /papers/<paperid>/files/resources Get the list of resources associated to this paper
GET /papers/<paperid>/files/resources/<resource> Get a resource associated to this paper
POST /papers/<paperid>/files/resources/<resource> Upload a new resource associated to this paper
DELETE /papers/<paperid>/files/resources/<resource> Delete a resource associated to this paper
GET /papers/<paperid>/files/synchronized Get the list of synchronized files for this paper
GET /papers/<paperid>/zip Get a tarball of the paper source files (both synchronized and resources)
POST /papers/<paperid>/join Join the paper
POST /papers/<paperid>/part Leave the paper

Create paper

Mehtod: POST

Path: /papers

Parameters:

Name Type Description
paper_name string The paper name used for further reference madantory
paper_title string The paper title mandatory
template string The template to use optional

Response:

Code Value Meaning
201 paper identifier The paper was successfully created
400 error object Some parameters are missing
401 error object User could not be authenticated
500 error object Something wrong happened on the server side and the user could not be registered

Delete Paper

Mehtod: DELETE

Path: /papers/<paperid>

Response:

Code Value Meaning
200 true The paper was successfully deleted
401 error object User could not be authenticated
403 error object Authenticated user has no sufficient rights to delete the paper
500 error object Something wrong happened on the server side

Get the Paper Data

Mehtod: GET

Path: /papers/<paperid>/info

Response:

Code Value Meaning Headers
200 paper object The paper data ETag contains the revision of the paper data (to be used when modifying them)
401 error object User could not be authenticated N/A
404 error object The paper could not be found N/A
500 error object Something wrong happened on the server side N/A

A paper object is as follows:

{
  "name": "Writing Good Documentation",
  "creation_date": "2014-06-20T17:57:21.902"
}

Modify the Paper Data

Mehtod: PATCH

Path: /papers/<paperid>/info

Headers: If-Match contains the revision of the paper data to modify (as returned in the ETag header)

Body: A Json Patch document as per RFC-6902 that modifies the paper data. A prerequisite is that the structure of the object must not be modified, only the values of standard fields (no new fields, no mandatory field removed, ...)

Response:

Code Value Meaning Headers
200 true The paper data was successfully modified ETag contains the new revision of the paper data after modifications were applied
304 error object Not enough data were sent to perform modification N/A
401 error object User must be authenticated N/A
403 error object Not authorized to modifiy the paper data N/A
404 error object Paper does not exist N/A
409 error object No revision or an obsolete revision was provided in the request N/A
500 error object Something wrong happened on the server side and the action could not be performed N/A

Get the Paper Roles

Mehtod: GET

Path: /papers/<paperid>/roles

Response:

Code Value Meaning Headers
200 paper object The paper data ETag contains the revision of the paper roles (to be used when modifying them)
401 error object User could not be authenticated N/A
404 error object The paper could not be found N/A
500 error object Something wrong happened on the server side N/A

A paper object is as follows:

{
  "authors": [ "glambert", "pprince" ],
  "reviewers": []
}

Modify the Paper Roles

Mehtod: PATCH

Path: /papers/<paperid>/roles

Headers: If-Match contains the revision of the paper roles to modify (as returned in the ETag header)

Body: A Json Patch document as per RFC-6902 that modifies the paper roles. A prerequisite is that the structure of the object must not be modified, only the values of standard fields (no new fields, no mandatory field removed, ...)

Response:

Code Value Meaning Headers
200 true The paper roles was successfully modified ETag contains the new revision of the paper roles after modifications were applied
304 error object Not enough data were sent to perform modification N/A
401 error object User must be authenticated N/A
403 error object Not authorized to modifiy the paper data N/A
404 error object Paper does not exist N/A
409 error object No revision or an obsolete revision was provided in the request N/A
500 error object Something wrong happened on the server side and the action could not be performed N/A

Get the Paper Resource List

Mehtod: GET

Path: /papers/<paperid>/files/resources

Response:

Code Value Meaning
200 resource list The list of resource names associated to this paper
401 error object User must be authenticated
403 error object Not authorized to get the list of resources
500 error object Something wrong happened on the server side and the action could not be performed

Get a Paper Resource

Mehtod: GET

Path: /papers/<paperid>/files/resources/<resource>

Response:

Code Value Meaning Headers
200 resource The resource associated to this paper Content-Type is the mime type of the resource
401 error object User must be authenticated N/A
403 error object Not authorized to get the resource N/A
500 error object Something wrong happened on the server side and the action could not be performed N/A

Upload a Paper Resource

Mehtod: POST (multipart or not)

Path: /papers/<paperid>/files/resources/<resource>

Parts or Body: the resource to upload

Response:

Code Value Meaning
200 true The resource was successfully uploaded to the paper
204 error object No file sent
401 error object User must be authenticated
403 error object Not authorized to upload the resource
500 error object Something wrong happened on the server side and the action could not be performed

Delete a Paper Resource

Mehtod: DELETE

Path: /papers/<paperid>/files/resources/<resource>

Response:

Code Value Meaning
200 resource The resource associated to this paper
401 error object User must be authenticated
403 error object Not authorized to delete the resource
500 error object Something wrong happened on the server side and the action could not be performed

Get List of Synchronized Files

Mehtod: GET

Path: /papers/<paperid>/files/synchronized

Response:

Code Value Meaning
200 resource list The list of synchronized file names for this paper
401 error object User must be authenticated
403 error object Not authorized to get the list of files
500 error object Something wrong happened on the server side and the action could not be performed

Get Tarball of the project

Mehtod: GET

Path: /papers/<paperid>/zip

Response:

Code Value Meaning Headers
200 zip file The paper source files and resources zipped Content-Type is application/zip
401 error object User must be authenticated
403 error object Not authorized to get the tarball
500 error object Something wrong happened on the server side and the action could not be performed

Join a Paper

Mehtod: POST

Path: /papers/<paperid>/join

Response:

Code Value Meaning
200 true Client joined the paper
401 error object User has no sufficient rights to join the paper
500 error object Something wrong happened on the server side and the user could not be registered

Leave a Paper

Mehtod: POST

Path: /papers/<paperid>/part

Response:

Code Value Meaning
200 true Client left the paper
401 error object User has no sufficient rights to leave the paper
500 error object Something wrong happened on the server side and the user could not be registered