Jump to >

New in version 1.6.

Draft File Attachment Resource

Name draft_file_attachment
URI /api/review-requests/{review_request_id}/draft/file-attachments/{file_attachment_id}/
Description

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.

HTTP Methods
  • DELETE - Deletes the file attachment from the draft.
  • GET - Returns the serialized object for the resource.
  • PUT - Updates the file’s data.
Parent Resource Draft File Attachment List Resource
Child Resources None
Anonymous Access No

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.
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.

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.

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 file’s data.

This allows updating the file in a draft. The caption, currently, is the only thing that can be updated.

Request Parameters

Field Type Description
caption (optional) String The new caption for the file.

Examples

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

{
  "draft_file_attachment": {
    "caption": "Example Attachment", 
    "filename": "screenshot1.png", 
    "icon_url": "/media/rb/images/mimetypes/text-x-generic.png?0", 
    "id": 1, 
    "links": {
      "delete": {
        "href": "http://reviews.example.com/api/review-requests/8/draft/file-attachments/1/", 
        "method": "DELETE"
      }, 
      "self": {
        "href": "http://reviews.example.com/api/review-requests/8/draft/file-attachments/1/", 
        "method": "GET"
      }, 
      "update": {
        "href": "http://reviews.example.com/api/review-requests/8/draft/file-attachments/1/", 
        "method": "PUT"
      }
    }, 
    "url": "/media/uploaded/images/2010/08/13/screenshot1.png"
  }, 
  "stat": "ok"
}

application/vnd.reviewboard.org.draft-file-attachment+xml

<?xml version="1.0" encoding="utf-8"?>
<rsp>
 <stat>ok</stat>
 <draft_file_attachment>
  <links>
   <self>
    <href>http://reviews.example.com/api/review-requests/8/draft/file-attachments/1/</href>
    <method>GET</method>
   </self>
   <update>
    <href>http://reviews.example.com/api/review-requests/8/draft/file-attachments/1/</href>
    <method>PUT</method>
   </update>
   <delete>
    <href>http://reviews.example.com/api/review-requests/8/draft/file-attachments/1/</href>
    <method>DELETE</method>
   </delete>
  </links>
  <url>/media/uploaded/images/2010/08/13/screenshot1.png</url>
  <icon_url>/media/rb/images/mimetypes/text-x-generic.png?0</icon_url>
  <filename>screenshot1.png</filename>
  <caption>Example Attachment</caption>
  <id>1</id>
 </draft_file_attachment>
</rsp>