Diff File Attachment List 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.
- Version Changed:
7.0: Added support for HTTP POST to the list resource.
Details¶
Name | diff_file_attachments |
URI | /api/repositories/{repository_id}/diff-file-attachments/ |
Token Policy ID | diff_file_attachment |
HTTP Methods | |
Parent Resource | |
Child Resources |
Links¶
Name |
Method |
Resource |
---|---|---|
create | POST |
|
self | GET |
HTTP GET¶
Returns the list of file attachments associated with diffs.
Each item in this list is a file attachment associated with a file or a proposed change against the parent repository. A file attachment may be referenced by one or more diffs.
Request Parameters¶
counts-onlyBoolean | If specified, a single |
max-resultsInteger | 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. |
mimetypeString | Filter file attachments with the given mimetype. |
repository-file-pathString | Filter file attachments with the given path in the repository. |
repository-revisionString | Filter file attachments for files with the given revision. |
startInteger | 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¶
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. |
HTTP POST¶
Creates a new diff file attachment.
This will create a new file attachment and connect it to the provided FileDiff, for use with binary files in diffs.
Request Parameters¶
filediffInteger | Required The ID of the FileDiff to create the attachment for. |
source_fileBoolean | Whether to create the attachment for the source version of the file. If false or not specified, the attachment will be created for the modified version. Added in 7.0 |
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.diff-file-attachments+json¶
$ curl https://reviews.example.com/api/repositories/1/diff-file-attachments/ -H "Accept: application/json"
HTTP 200 OK
Content-Length: 3354
Content-Type: application/vnd.reviewboard.org.diff-file-attachments+json
ETag: 2f64ac42825598ee75870bfd6aebe6b34b6e97de
Item-Content-Type: application/vnd.reviewboard.org.diff-file-attachment+json
Vary: Accept, Cookie
X-Content-Type-Options: nosniff
{
"diff_file_attachments": [
{
"absolute_url": "http://example.com/r/9/file/2/download/",
"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=\"http://example.com/r/9/file/2/download/?thumbnail=1&width=300\" srcset=\"http://example.com/r/9/file/2/download/?thumbnail=1&width=300 1x, http://example.com/r/9/file/2/download/?thumbnail=1&width=600 2x, http://example.com/r/9/file/2/download/?thumbnail=1&width=900 3x\" alt=\"Sprite Sheet\" width=\"300\" /></div>",
"url": "http://example.com/r/9/file/2/download/"
},
{
"absolute_url": "http://example.com/r/9/file/3/download/",
"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": 3,
"links": {
"self": {
"href": "https://reviews.example.com/api/repositories/1/diff-file-attachments/3/",
"method": "GET"
}
},
"mimetype": "image/png",
"repository_file_path": "/images/spritesheet.png",
"repository_revision": "124",
"review_url": "/r/9/file/3/",
"revision": 0,
"thumbnail": "<div class=\"file-thumbnail\"> <img src=\"http://example.com/r/9/file/3/download/?thumbnail=1&width=300\" srcset=\"http://example.com/r/9/file/3/download/?thumbnail=1&width=300 1x, http://example.com/r/9/file/3/download/?thumbnail=1&width=600 2x, http://example.com/r/9/file/3/download/?thumbnail=1&width=900 3x\" alt=\"Sprite Sheet\" width=\"300\" /></div>",
"url": "http://example.com/r/9/file/3/download/"
},
{
"absolute_url": "http://example.com/r/9/file/4/download/",
"attachment_history_id": null,
"caption": "Logo",
"extra_data": {},
"filename": "logo.png",
"icon_url": "/static/rb/images/mimetypes/text-x-generic.png",
"id": 4,
"links": {
"added_in_filediff": {
"href": "https://reviews.example.com/api/review-requests/9/diffs/1/files/43/",
"method": "GET",
"title": "/images/logo.png (PRE-CREATION) -> /images/logo.png (1)"
},
"self": {
"href": "https://reviews.example.com/api/repositories/1/diff-file-attachments/4/",
"method": "GET"
}
},
"mimetype": "image/png",
"repository_file_path": "/images/logo.png",
"repository_revision": null,
"review_url": "/r/9/file/4/",
"revision": 0,
"thumbnail": "<div class=\"file-thumbnail\"> <img src=\"http://example.com/r/9/file/4/download/?thumbnail=1&width=300\" srcset=\"http://example.com/r/9/file/4/download/?thumbnail=1&width=300 1x, http://example.com/r/9/file/4/download/?thumbnail=1&width=600 2x, http://example.com/r/9/file/4/download/?thumbnail=1&width=900 3x\" alt=\"Logo\" width=\"300\" /></div>",
"url": "http://example.com/r/9/file/4/download/"
}
],
"links": {
"create": {
"href": "https://reviews.example.com/api/repositories/1/diff-file-attachments/",
"method": "POST"
},
"self": {
"href": "https://reviews.example.com/api/repositories/1/diff-file-attachments/",
"method": "GET"
}
},
"stat": "ok",
"total_results": 3
}