Updating a file attachment
Added by IBM contributorIBM | Edited by Claudia R Elbourn on June 30, 2015
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars

Update an attachment to a file in your file collection.

This request requires authentication. To update an attachment, the currently authenticated user must be the owner of the user library containing the document, an administrator, or have been shared with as an editor. To test whether the current user can update a file attachment, use the Retrieving file metadata API with the acls parameter set to true, and check the <td:permission> element for the EditContent flag.

Note: {document-id} is the value of the <td:uuid> or <td:label> element in the Atom entry document of the file with the attachment. {attachment-id} is the value of the <td:uuid> or <td:label> elements in the attachment's Atom entry document.

You can use one or more of these input parameters or headers with the request. Separate multiple parameters with an ampersand (&).

The following types of file attachments are supported:

  • Atom entry document that defines the metadata of the file and no binary data.
  • Multipart content
If done properly, you will make an Atom document representing the updated file attachment.
Input
Method URI Description
PUT /files/{auth}/api/myuserlibrary/document/{document-id}/attachment/{attachment-id}/entry Updates a file attachment.
Content Type: application/atom+xml
Name Type Optional Description
document-id
string No {document-id} is the value of the <td:uuid> or <td:label> element in the Atom entry document of the file with the attachment.
attachment-id
string No {attachment-id} is the value of the <td:uuid> or <td:label> elements in the attachment's Atom entry document.
auth
enumerated No The authorization protocol being used by your application to access Connections Cloud.
Authorized values:
  • basic
  • oauth
Name Type Optional Description
identifier
string Yes Indicates how the document is identified in the {document-id} variable segment of the web address. By default, the lookup operation is performed with the expectation that the URL contains the value from the <td:uuid> element of a document Atom entry, so the value uuid is used. Specify label if the URL instead contains the value from the <td:label> element of a document Atom entry. This parameter is only supported when creating a media resource file attachment.
lockParent
boolean Yes Specifies whether to lock the parent resource. Options are true or false. The default value is false.
submitParent
boolean Yes Specifies whether to submit the parent resource for approval if approval is enabled on the server. Options are true or false. The default value is false.
Name Type Optional Description
Content-Type
string No Used to specify the mime type for the content being sent to the server. If the collection does not support the specified content type, the server returns HTTP response code 415 (Unsupported media type).
When a media resource is posted, the mime-type of the resource is set to this value if it is provided. Otherwise, the mime-type of the extension of the Slug header is used. A Content-Type that is an empty string, white space only, or equal to "unknown/unknown" is considered to be not-specified. If this header is not present on the request, then the server returns HTTP response code of 400 (Bad request).
Content-Language
string No Specifies the language of the content being sent to the server. All contents are handled using UTF-8 encoding on the server.
Content-Length
string No Specifies the content length when sending media content. If this header is not present on the request, then the server returns HTTP response code of 411 (Length required).
Slug
string No Contains the file path and label of the resource to be added to the file. You can include nonASCII characters in this header, but they must be correctly encoded according to RFC 2047.
X-Method-Override
string Yes Tunnels a PUT request over the HTTP POST request.
X-Update-Nonce
string Yes String. Represents a unique data string generated by the server upon request that you can provide to secure the request. See Getting a nonce key for information about how to request the data string.
Authorization
enumerated No The authentication mechanism selected by your application to access the API.
Basic is the Base64 encoding of the IBM Connections Cloud username and password: Base64(username:password). For example, Base64(twatson@us.ibm.com:password).
Bearer is the oauth 2.0 access token that is generated when the user grants your application access to IBM Connections Cloud services.
See the reference topic "OAuth 2.0 APIs for web server flow" for more information.
Authorized values:
  • bearer
  • basic
Output
Code Description
200
OK. Indicates that the file attachment was successfully updated. If an error occurs, this header contains one of the error codes.
401
Unauthorized.
403
Forbidden.
404
Not Found.