Create a request

A verified researcher is able to create a new request. Doing this will create a request containing revisions with one revision pre-filled.

{info} Only a researcher can create requests


Method Uri Auth Role
POST /v1/requests 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 (fillable)

{
    "collection_id": "uuid"
}

Success Responses

Condition : User must be a researcher.

Code : 201 Created

Content example : Response will reflect back the created request. The request is the active request which is the latest created revision of the request.

{
  "id": "da36e947-9fb7-4153-ace9-f81b010d9147",
  "request": {
    "id": "7b1e42db-387e-47d9-8104-5d506cb6ae29",
    "title": null,
    "author": null,
    "coauthors": [],
    "has_informed_coauthors": 0,
    ...
  },
  "revisions": [
    {
      "id": "7b1e42db-387e-47d9-8104-5d506cb6ae29",
      ...
    }
  ],
  "created_at": "2020-07-24T09:49:21.000000Z",
  "updated_at": "2020-07-24T09:49:21.000000Z"
}

Error Responses

Condition : If the current user does not have the role researcher attached.

Code : 403 Unauthorized

Content example :

{
  "message": "User does not have the right roles."
}

Condition : If the provided collection_id does not exist or belong to the corresponding researcher.

Code : 422 Unprocessable Entity

Content example :

{
    "message": "The given data was invalid.",
    "errors": {
        "collection_id": [
            "The selected collection id is invalid."
        ]
    }
}