New in version 1.6.
File Attachment List Resource¶
Name | file_attachments |
URI | /api/review-requests/{review_request_id}/file-attachments/ |
Description | A resource representing a screenshot on a review request. |
HTTP Methods | |
Parent Resource | Review Request Resource |
Child Resources | |
Anonymous Access | Yes, if anonymous site access is enabled |
Links¶
Name | Method | Resource |
---|---|---|
create | POST | File Attachment List Resource |
self | GET | File Attachment List Resource |
HTTP GET¶
Returns a list of file attachments on the review request.
Each screenshot in this list is a file attachment attachment that is shown on the review request.
Request Parameters¶
Field | Type | Description |
---|---|---|
counts-only (optional) | Boolean | If specified, a single count field is returned with the number of results, instead of the results themselves. |
max-results (optional) | Integer | The maximum number of results to return in this list. By default, this is 25. There is a hard limit of 200; if you need more than 200 results, you will need to make more than one request, using the “next” pagination link. |
start (optional) | Integer | The 0-based index of the first result in the list. The start index is usually the previous start index plus the number of previous results. By default, this is 0. |
Errors¶
HTTP POST¶
Creates a new file attachment from a file attachment.
This accepts any file type and associates it with a draft of a review request.
Creating a new file attachment will automatically create a new review request draft, if one doesn’t already exist. This attachment will be part of that draft, and will be shown on the review request when it’s next published.
It is expected that the client will send the data as part of a multipart/form-data mimetype. The file’s name and content should be stored in the path field. A typical request may look like:
-- SoMe BoUnDaRy
Content-Disposition: form-data; name=path; filename="foo.zip"
<Content here>
-- SoMe BoUnDaRy --
Request Parameters¶
Field | Type | Description |
---|---|---|
caption (optional) | String | The optional caption describing the file. |
path (required) | Uploaded File | The file to upload. |
Examples¶
application/vnd.reviewboard.org.file-attachments+json¶
{
"file_attachments": [
{
"caption": "Example Attachment",
"filename": "screenshot1.png",
"icon_url": "/static/rb/images/mimetypes/image-x-generic.png",
"id": 1,
"links": {
"delete": {
"href": "http://reviews.example.com/api/review-requests/8/file-attachments/1/",
"method": "DELETE"
},
"file_attachment_comments": {
"href": "http://reviews.example.com/api/review-requests/8/file-attachments/1/file-attachment-comments/",
"method": "GET"
},
"self": {
"href": "http://reviews.example.com/api/review-requests/8/file-attachments/1/",
"method": "GET"
},
"update": {
"href": "http://reviews.example.com/api/review-requests/8/file-attachments/1/",
"method": "PUT"
}
},
"review_url": "/r/8/file/1/",
"thumbnail": "<img src=\"/media/uploaded/images/2010/08/13/screenshot1_400x100.png\" class=\"file-thumbnail\" alt=\"Example Attachment\" />",
"url": "http://example.com/media/uploaded/images/2010/08/13/screenshot1.png"
}
],
"links": {
"create": {
"href": "http://reviews.example.com/api/review-requests/8/file-attachments/",
"method": "POST"
},
"self": {
"href": "http://reviews.example.com/api/review-requests/8/file-attachments/",
"method": "GET"
}
},
"stat": "ok",
"total_results": 1
}
application/vnd.reviewboard.org.file-attachments+xml¶
<?xml version="1.0" encoding="utf-8"?>
<rsp>
<total_results>1</total_results>
<stat>ok</stat>
<file_attachments>
<array>
<item>
<links>
<self>
<href>http://reviews.example.com/api/review-requests/8/file-attachments/1/</href>
<method>GET</method>
</self>
<file_attachment_comments>
<href>http://reviews.example.com/api/review-requests/8/file-attachments/1/file-attachment-comments/</href>
<method>GET</method>
</file_attachment_comments>
<update>
<href>http://reviews.example.com/api/review-requests/8/file-attachments/1/</href>
<method>PUT</method>
</update>
<delete>
<href>http://reviews.example.com/api/review-requests/8/file-attachments/1/</href>
<method>DELETE</method>
</delete>
</links>
<url>http://example.com/media/uploaded/images/2010/08/13/screenshot1.png</url>
<icon_url>/static/rb/images/mimetypes/image-x-generic.png</icon_url>
<thumbnail><img src="/media/uploaded/images/2010/08/13/screenshot1_400x100.png" class="file-thumbnail" alt="Example Attachment" /></thumbnail>
<filename>screenshot1.png</filename>
<caption>Example Attachment</caption>
<review_url>/r/8/file/1/</review_url>
<id>1</id>
</item>
</array>
</file_attachments>
<links>
<self>
<href>http://reviews.example.com/api/review-requests/8/file-attachments/</href>
<method>GET</method>
</self>
<create>
<href>http://reviews.example.com/api/review-requests/8/file-attachments/</href>
<method>POST</method>
</create>
</links>
</rsp>