Community articleAdding a file using a multipart POST
Added by IBM contributorIBM on March 21, 2014
Rate this article 1 starsRate this article 2 starsRate this article 3 starsRate this article 4 starsRate this article 5 stars1 comment

Add a file to your library using a multipart POST.



Add a file to your library using a multipart POST.

See Authenticating requests for information about how to authenticate the request.

Input

A multipart post in which each parameter has a Content-Disposition: form-data, and the name is the parameter name.

Output

An HTML page with JSON in the body.

Input
Method URI Description
POST /files/form/api/myuserlibrary/feed Adds the binary data and creates a file Atom document containing the metadata of a file to your library.
Name Type Optional Description
commentNotification
enumerated Yes String. Specifies whether you want to get a notification when someone adds or updates a comment on a file. Options are on or off. The default value is on.
Authorized values:
  • on
  • off
description
string Yes Summary of the document in plain text.
file
string Yes Contains the binary media of the file.
label
string Yes Label of the file to be created.
mediaNotification
enumerated Yes String. Specifies whether the person updating the file wants to get a notification when someone subsequently updates the file. Options are on or off. The default value is off.
Authorized values:
  • on
  • off
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 cryptographic key for information about how to request the data string. If both are specified, the value in this parameter takes precedence over the value of X-Update-Nonce in the header.
sharePermission
enumerated Yes Defines the level of permission that the people listed in the sharedWith parameter have to the file. Only applicable if the sharedWith parameter is passed. Permission level options are Edit or View. The default value is View.
Authorized values:
  • Edit
  • View
shareSummary
string Yes Text. Explanation of the share.
shareWith
string Yes User ID of the user to share the content with. This parameter can be applied multiple times. Supports multivalue.
tag
string Yes String. Keyword that helps to classify the file. This parameter can be applied multiple times if multiple tags are passed. Supports multivalue.
visibility
enumerated Yes String. Specifies who can see the file. Options are private or public. A public file is visible to all users and can be shared by all users. The default value is private.
Authorized values:
  • private
  • public
Name Type Optional Description
Content-Type
string Yes 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, whitespace only, or equal to "unknown/unknown" is considered to be not-specified.
Content-Language
string Yes 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 Yes Specifies the content length when sending media content.
X-Update-Nonce
string Yes String. Represents a unique data string generated by the server upon request that you must provide to secure the request. See Getting a cryptographic key for information about how to request the data string.
Output
Content Type: application/json
Code Description
200
Indicates that the file entry was successfully created. If an error occurs, this header contains one of the error codes.
401
Unauthorized.
403
Forbidden.
404
Not Found.
409
Conflict.
415
Unsupported media type
Joel Abbott commented on Aug 23, 2016

Re: Adding a file using a multipart POST

For large files, see alternative API https://www-10.lotus.com/ldd/appdevwiki.nsf/xpAPIViewer.xsp?lookupName=API+Reference#action=openDocument&res_title=Large_File_Upload&content=apicontent