Jump to >

This documentation covers Review Board 2.0. You can see the latest Review Board documentation or all other versions.

File Attachment Resource

A resource representing a file attachment on a review request.

Details

Name file_attachment
URI /api/review-requests/{review_request_id}/file-attachments/{file_attachment_id}/
HTTP Methods
  • DELETE - Deletes the file attachment.
  • GET - Returns the serialized object for the resource.
  • PUT - Updates the file attachment’s data.
Parent Resource File Attachment List Resource
Child Resources
Anonymous Access Yes, if anonymous site access is enabled

Fields

absolute_urlString

The absolute URL of the file, for downloading purposes.

Added in 2.0

captionString The file’s descriptive caption.
filenameString The name of the file.
icon_urlString The URL to a 24x24 icon representing this file.
idInteger The numeric ID of the file.
mimetypeString The mimetype for the file.
review_urlString The URL to a review UI for this file.
thumbnailString A thumbnail representing this file.
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

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.

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

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

HTTP PUT

Updates the file attachment’s data.

This allows updating information on the file attachment.

Updating a file attachment 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

captionString The new caption for the file.
thumbnailString The thumbnail data for the file.

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

Examples

application/vnd.reviewboard.org.file-attachment+json

$ curl http://reviews.example.com/api/review-requests/8/file-attachments/1/ -H "Accept: application/json"
Vary: Accept, Cookie
ETag: ff39d7d7c1f0ce8c5df2da68c96e63ef4848188b
Content-Type: application/vnd.reviewboard.org.file-attachment+json
X-Content-Type-Options: nosniff
{
  "file_attachment": {
    "absolute_url": "http://example.com/media/uploaded/images/2010/08/13/screenshot1.png", 
    "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"
      }
    }, 
    "mimetype": "image/png", 
    "review_url": "/r/8/file/1/", 
    "thumbnail": "<img src=\"/media/uploaded/images/2010/08/13/screenshot1_400x100.png\" data-at2x=\"/media/uploaded/images/2010/08/13/screenshot1_800x200.png\" class=\"file-thumbnail\" alt=\"Example Attachment\" />", 
    "url": "http://example.com/media/uploaded/images/2010/08/13/screenshot1.png"
  }, 
  "stat": "ok"
}