Add a photo or video to a contribution.
Currently the following file formats are supported:
.png
, .jpg
, .jpeg
, .gif
.mov
, .mpeg4
, .avi
, .wmv
, .flv
, .3gpp
, .3gpp2
, .webm
.wave
, .wav
, .mp3
, .3gpp
, .3gpp2
POST /api/projects/:project_id/contributions/:contribution_id/media/
Parameter | Type | Description |
---|---|---|
project_id |
Integer |
Unique identifier for the project. |
contribution_id |
Integer |
Unique identifier for the contribution. |
Header | Required value |
---|---|
Content-Type |
multipart/form-data |
---XXX---
Content-Disposition: form-data; name="name"
Photo of the playground
---XXX---
Content-Disposition: form-data; name="description"
It clearly shows that the swing is broken
---XXX---
Content-Disposition: form-data; name="file"; filename="file.png"
Content-Type: image/png
---XXX---
The response contains a document attached to the contribution.
{
"id": 66,
"name": "Photo of the playground",
"description": "It clearly shows that the swing is broken",
"isowner": true,
"url": "/media/user-uploads/img-2165.jpg",
"thumbnail_url": "/media/user-uploads/img-2165.jpg.300x300_q85_crop.png",
"file_type": "ImageFile",
"creator": {
"id": 422,
"display_name": "Peter Schmeichel"
},
"created_at": "2014-06-05T11:31:02.613Z"
}
Code | Reason |
---|---|
201 | The document has been created successfully. |
404 | The project or contribution or document was not found. For security reasons we do not leak information about private projects, hence we don’t confirm existence private projects to unauthorised users. |