Create a researcher's collection

A verified researcher is able to create data collections.

{info} Only a researcher can create collections


Method Uri Auth Role
POST /v1/collections 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

{
    "name": "string",
    "variables": "array",
    "variables.*": ["exists:variables,id"]
}

Success Responses

Condition : User must be a researcher.

Code : 200 Okay

Content example : Response will reflect back the created requests.

{
    "id": "ff6cbf66-b6dd-4c49-a5d3-9e35b4bf044a",
    "name": "Test name",
    "variables": [
        {
            "id": "007a491b-90af-46a4-8879-3e9b91622c42",
            "name": "B4_VD1_9.19",
            ...
            ]
        },
        {
            "id": "0074d4bc-25f8-4b73-807a-cdaff6b4e5d9",
            "name": "B8_VMS10.3.1.1.1",
            ...
        }
    ]
}

Error Responses

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

Code : 403 Unauthorized

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

Condition : If variables do not exist.

Code : 422 Unprocessable Entity

{
  "message": "The given data was invalid.",
  "errors": {
    "variables.0": [
      "The selected variables.0 is invalid."
    ]
  }
}