Upload a variables file

A verified researcher is able to upload a files to his/hers active request revision as long as it is in the state of draft or revision.

{info} Only a researcher can upload files to his/hers active request revision


Method Uri Auth Role
POST /v1/requests/{UUID}/files Bearer JWT-Token researcher

Headers

The API requires a header Accept to be submitted with the request:

{
    "Accept": "application/json",
    "Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3M..." 
}

Data constraints

{
    "file": "file",
    "type": "required, in: mocktables (multi), variables (single), manuscripts (multi)"
}

Success Responses

Condition : User must be a researcher.

Code : 200 Okay

Content example : Response will reflect back the upload file info.

{
    "name": "Untitled-spreadsheet (1)",
    "file_name": "Untitled-spreadsheet-(1).xlsx",
    "collection_name": "variables",
    "mime_type": "application\/vnd.openxmlformats-officedocument.spreadsheetml.sheetapplication\/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
    "disk": "public",
    "conversions_disk": "public",
    "size": 4732,
    "path": "\/home\/vagrant\/apply\/storage\/app\/public\/40\/Untitled-spreadsheet-(1).xlsx"
}

Error Responses

Condition : If the current user does not have the role researcher attached and is not the owning request user. Condition : If the current request is not in draft, revision or delivered state.

Code : 403 Unauthorized

Content example :

{
    "message": "You\'re not allowed to upload to this file (state: awaiting_review)"
}

Condition : If the specified collection type is not mocktables, variables or manuscripts.

Code : 422 Unprocessable Entity

Content example :

{
    "message": "The given data was invalid.",
    "errors": {
        "type": [
            "Specify what name of mediacollection you're uploading to: \"mocktable\" \/ \"variables\" \/ \"manuscripts\""
        ]
    }
}