Draft File Attachment Resource¶
Added in 1.6
Provides information on new file attachments being added to a draft of a review request.
These are files that will be shown once the pending review request draft is published.
Details¶
Name | draft_file_attachment |
URI | /api/review-requests/{review_request_id}/draft/file-attachments/{file_attachment_id}/ |
Token Policy ID | draft_file_attachment |
HTTP Methods | |
Parent Resource | |
Child Resources | None |
Fields¶
absolute_urlString | The absolute URL of the file, for downloading purposes. Added in 2.0 |
attachment_history_idInteger | ID of the corresponding FileAttachmentHistory. Added in 2.5 |
captionString | The file’s descriptive caption. |
extra_dataDictionary | Extra data as part of the file attachment. This can be set by the API or extensions. Added in 6.0 |
filenameString | The name of the file. |
icon_urlString | Deprecated The URL to a 24x24 icon representing this file. The use of these icons is deprecated and this property will be removed in a future version. Deprecated in 2.5 |
idInteger | The numeric ID of the file. |
mimetypeString | The mimetype for the file. Added in 2.0 |
review_urlString | The URL to a review UI for this file. Added in 1.7 |
revisionInteger | The revision of the file attachment. Added in 2.5 |
thumbnailString | A thumbnail representing this file. Added in 1.7 |
urlString | Deprecated 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. This is deprecated and will be removed in a future version. Deprecated in 2.0 |
Links¶
Name |
Method |
Resource |
---|---|---|
delete | DELETE |
|
self | GET |
|
update | PUT |
HTTP DELETE¶
Deletes the file attachment from the draft.
This will remove the file attachment from the draft review request. This cannot be undone.
This can be used to remove old files that were previously shown, as well as newly added files that were part of the draft.
Instead of a payload response on success, this will return HTTP 204 No Content.
Errors¶
100 - Does Not ExistHTTP 404 - Not Found | Object does not exist |
101 - Permission DeniedHTTP 403 - Forbidden | You don’t have permission for this |
103 - Not Logged InHTTP 401 - Unauthorized | You are not logged in |
112 - OAuth2 Missing Scope ErrorHTTP 403 - Forbidden | Your OAuth2 token lacks the necessary scopes for this request. |
113 - OAuth2 Access Denied ErrorHTTP 403 - Forbidden | OAuth2 token access for this resource is prohibited. |
HTTP GET¶
Returns the serialized object for the resource.
This will require login if anonymous access isn’t enabled on the site.
Errors¶
100 - Does Not ExistHTTP 404 - Not Found | Object does not exist |
101 - Permission DeniedHTTP 403 - Forbidden | You don’t have permission for this |
103 - Not Logged InHTTP 401 - Unauthorized | You are not logged in |
112 - OAuth2 Missing Scope ErrorHTTP 403 - Forbidden | Your OAuth2 token lacks the necessary scopes for this request. |
113 - OAuth2 Access Denied ErrorHTTP 403 - Forbidden | OAuth2 token access for this resource is prohibited. |
HTTP PUT¶
Updates the file’s data.
This allows updating the file in a draft. Currently, only the caption, thumbnail and extra_data can be updated. See Storing/Accessing Extra Data for more information.
Set pending_deletion=false
in the request to undo the pending
deletion of a published file attachment. Setting this to true
is
unsupported and will not delete the file attachment. To perform a
deletion, perform a HTTP DELETE on the resource instead.
Request Parameters¶
captionString | The new caption for the file. |
pending_deletionBoolean | Whether the file attachment is currently pending deletion. This can be set to Added in 6.0 |
thumbnailString | The thumbnail data for the file. Added in 1.7.7 |
Errors¶
100 - Does Not ExistHTTP 404 - Not Found | Object does not exist |
101 - Permission DeniedHTTP 403 - Forbidden | You don’t have permission for this |
103 - Not Logged InHTTP 401 - Unauthorized | You are not logged in |
105 - Invalid Form DataHTTP 400 - Bad Request | One or more fields had errors |
112 - OAuth2 Missing Scope ErrorHTTP 403 - Forbidden | Your OAuth2 token lacks the necessary scopes for this request. |
113 - OAuth2 Access Denied ErrorHTTP 403 - Forbidden | OAuth2 token access for this resource is prohibited. |
Examples¶
application/vnd.reviewboard.org.draft-file-attachment+json¶
$ curl https://reviews.example.com/api/review-requests/8/draft/file-attachments/1/ -H "Accept: application/json"
HTTP 200 OK
Content-Length: 1092
Content-Type: application/vnd.reviewboard.org.draft-file-attachment+json
ETag: 013b079b0e47bb1c9df10a418ac876bfbbca8c0a
Vary: Accept, Cookie
X-Content-Type-Options: nosniff
{
"draft_file_attachment": {
"absolute_url": "http://example.com/media/uploaded/images/2010/08/13/screenshot1.png",
"attachment_history_id": null,
"caption": "",
"extra_data": {},
"filename": "screenshot1.png",
"icon_url": "/static/rb/images/mimetypes/text-x-generic.png",
"id": 1,
"links": {
"delete": {
"href": "https://reviews.example.com/api/review-requests/8/draft/file-attachments/1/",
"method": "DELETE"
},
"self": {
"href": "https://reviews.example.com/api/review-requests/8/draft/file-attachments/1/",
"method": "GET"
},
"update": {
"href": "https://reviews.example.com/api/review-requests/8/draft/file-attachments/1/",
"method": "PUT"
}
},
"mimetype": "image/png",
"review_url": "/r/8/file/1/",
"revision": 0,
"thumbnail": "<div class=\"file-thumbnail\"> <img src=\"/media/uploaded/images/2010/08/13/screenshot1_300.png\" srcset=\"/media/uploaded/images/2010/08/13/screenshot1_300.png 1x, /media/uploaded/images/2010/08/13/screenshot1_600.png 2x\" alt=\"Example Attachment\" width=\"300\" /></div>",
"url": "http://example.com/media/uploaded/images/2010/08/13/screenshot1.png"
},
"stat": "ok"
}