Diff File Attachment Resource¶
Added in 2.0
Provides information on file attachments associated with files in diffs.
The list of file attachments are tied to files either committed to the repository or proposed in diffs to a review request on the repository. All are associated with a file in a diff.
Files that are newly introduced in a diff and do not have a revision as
of that diff will have the added_in_filediff
link set, and
repository_revision
will be null.
Details¶
Name | diff_file_attachment |
URI | /api/repositories/{repository_id}/diff-file-attachments/{file_attachment_id}/ |
Token Policy ID | diff_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 |
added_in_filediffFile Diff Resource | The file diff that introduced this file. If set, this file is just part of a proposed change, and not necessarily committed in the repository. |
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 |
repository_file_pathString | The file path inside the repository that this file attachment represents. |
repository_revisionString | The revision that introduced this version of the file, if committed in the repository. |
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 |
---|---|---|
self | GET |
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. |
Examples¶
application/vnd.reviewboard.org.diff-file-attachment+json¶
$ curl https://reviews.example.com/api/repositories/1/diff-file-attachments/2/ -H "Accept: application/json"
HTTP 200 OK
Content-Length: 1126
Content-Type: application/vnd.reviewboard.org.diff-file-attachment+json
ETag: 21afccbee9f2df723d3234e5e7d91fdb74b1ecfd
Vary: Accept, Cookie
X-Content-Type-Options: nosniff
{
"diff_file_attachment": {
"absolute_url": "http://example.com/media/uploaded/files/2013/09/06/98e2a2c1-2c97-4d65-af27-d426ca6ae2d3__image1.png",
"added_in_filediff": null,
"attachment_history_id": null,
"caption": "Sprite Sheet",
"extra_data": {},
"filename": "spritesheet.png",
"icon_url": "/static/rb/images/mimetypes/text-x-generic.png",
"id": 2,
"links": {
"self": {
"href": "https://reviews.example.com/api/repositories/1/diff-file-attachments/2/",
"method": "GET"
}
},
"mimetype": "image/png",
"repository_file_path": "/images/spritesheet.png",
"repository_revision": "123",
"review_url": "/r/9/file/2/",
"revision": 0,
"thumbnail": "<div class=\"file-thumbnail\"> <img src=\"/media/uploaded/files/2013/09/06/98e2a2c1-2c97-4d65-af27-d426ca6ae2d3__image1_300.png\" srcset=\"/media/uploaded/files/2013/09/06/98e2a2c1-2c97-4d65-af27-d426ca6ae2d3__image1_300.png 1x, /media/uploaded/files/2013/09/06/98e2a2c1-2c97-4d65-af27-d426ca6ae2d3__image1_600.png 2x\" alt=\"Sprite Sheet\" width=\"300\" /></div>",
"url": "http://example.com/media/uploaded/files/2013/09/06/98e2a2c1-2c97-4d65-af27-d426ca6ae2d3__image1.png"
},
"stat": "ok"
}