New in version 1.6.
File Attachment Resource¶
Name | file_attachment |
URI | /api/review-requests/{review_request_id}/file-attachments/{file_attachment_id}/ |
Description | A resource representing a screenshot on a review request. |
HTTP Methods | |
Parent Resource | File Attachment List Resource |
Child Resources | |
Anonymous Access | Yes, if anonymous site access is enabled |
Fields¶
Field | Type | Description |
---|---|---|
caption | String | The file’s descriptive caption. |
filename | String | The name of the file. |
icon_url | String | The URL to a 24x24 icon representing this file. |
id | Integer | The numeric ID of the file. |
review_url | String | The URL to a review UI for this file. |
thumbnail | String | A thumbnail representing this file. |
url | String | The URL of the file, for downloading purposes. If this is not an absolute URL, then it’s relative to the Review Board server’s URL. |
Links¶
Name | Method | Resource |
---|---|---|
delete | DELETE | File Attachment Resource |
file_attachment_comments | GET | File Attachment Comment List Resource |
self | GET | File Attachment Resource |
update | PUT | File Attachment Resource |
HTTP DELETE¶
Deletes the file attachment
This will remove the file attachment from the draft review request. This cannot be undone.
Deleting a file attachment will automatically create a new review request draft, if one doesn’t already exist. The attachment won’t be actually removed until the review request draft is published.
This can be used to remove old file attachments that were previously shown, as well as newly added file attachments that were part of the draft.
Instead of a payload response on success, this will return HTTP 204 No Content.
HTTP GET¶
Returns the serialized object for the resource.
This will require login if anonymous access isn’t enabled on the site.
HTTP PUT¶
Updates the screenshot’s data.
This allows updating the screenshot. The caption, currently, is the only thing that can be updated.
Updating a screenshot will automatically create a new review request draft, if one doesn’t already exist. The updates won’t be public until the review request draft is published.
Request Parameters¶
Field | Type | Description |
---|---|---|
caption (optional) | String | The new caption for the file. |
thumbnail (optional) | String | The thumbnail data for the file. |
Examples¶
application/vnd.reviewboard.org.file-attachment+json¶
{
"file_attachment": {
"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"
},
"stat": "ok"
}
application/vnd.reviewboard.org.file-attachment+xml¶
<?xml version="1.0" encoding="utf-8"?>
<rsp>
<stat>ok</stat>
<file_attachment>
<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>
</file_attachment>
</rsp>