A verified admin is able to create a new asset.
{info} Only an admin can create requests
Method | Uri | Auth | Role |
---|---|---|---|
POST |
/v1/assets |
Bearer JWT-Token |
admin |
{
"Accept": "application/json",
"Content-Type": "multipart/form-data",
"Authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3M..."
}
{
"title": "This is an asset",
"description": "This is an asset description",
"original": File,
"preview": File,
"files[]": File,
"files[]": File,
...
}
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": "0edf2ca5-81d6-48cd-825f-f1d7c478eaa9",
"title": "This is an asset",
"description": "This is an asset description",
"original": null,
"preview": null,
"files": [
{
"uuid": "0b8c9a21-b44f-4713-937a-de684ea4cd88",
"name": "vans-x-nasa-sk8-hi-46-mte-dx-space-voyager-space-vger-true-wh-marshm-va3dq5uq4-os-1",
"file_name": "vans-x-nasa-sk8-hi-46-mte-dx-space-voyager-space-vger-true-wh-marshm-va3dq5uq4-os-1.jpg",
"url": "http:\/\/huisstijlgids.test\/storage\/1\/vans-x-nasa-sk8-hi-46-mte-dx-space-voyager-space-vger-true-wh-marshm-va3dq5uq4-os-1.jpg",
"mimetype": "image\/jpeg",
"path": "\/home\/vagrant\/huisstijlgids\/storage\/app\/public\/1\/vans-x-nasa-sk8-hi-46-mte-dx-space-voyager-space-vger-true-wh-marshm-va3dq5uq4-os-1.jpg",
"size": 125920,
"extension": "jpg",
"width": 930,
"height": 669
}
],
"created_at": "2020-08-20T13:33:32.000000Z"
}
Condition : If the current user does not have the role admin
attached.
Code : 403 Forbidden
Content example :
{
"message": "The asset cannot be created"
}
Condition : If the current user is not logged in
Code : 401 Unauthorized
Content example :
{
"message": "Je moet zijn ingelogd om dit te kunnen doen.",
"errors": [
"Unauthenticated."
]
}