Inputs and Binary File Upload Examples
Using POST, PATCH, or PUT for Input
When you make a request using the HTTP POST, PATCH, and PUT methods, you can use request parameters or a request body. The request body can contain JSON or XML. If you pass resource-specific request parameters and a request body, the request parameters are ignored. Request parameters that aren’t specific to a resource, such as parameters in a bearer token URL and the _HttpMethod parameter, are processed along with the request body. Use bearer token parameters as they are. Don’t add or remove parameters.
To submit a request using request parameters, use a Content-Type header field with the value application/x-www-form-urlencoded.
To submit a request using a request body, use one of these values in a Content-Type header field and in an Accept header field.
- application/json
- application/xml
Uploading Binary Files
To upload a binary file up to 2 GB (including headers), up to 75 MB for an external repository, or up to 512 MB for bulk conversations, send it as a body part in a multipart/form-data request. You can send the text of a comment (but not a post) as a JSON or XML rich input body part in the same multipart/form-data request. Alternately, you can choose to send that information in request parameters. If you pass both a rich input request body and request parameters, the request parameters are ignored.
To upload multiple binary files in the same call, see Batch Resource.
To create a multipart/form-data request, in the head of the request, set the Content-Type HTTP header to multipart/form-data.
For information about HTTP headers, see W3C Form content types, and RFC 2388, which defines the multipart/form-data internet media type.
This table describes the HTTP headers and parameters required in the rich input body part of a multipart/form-data request.
| HTTP Headers for Rich Input Body Part | Header Value and Parameters | Description |
|---|---|---|
| Content-Disposition |
form-data; name="json" form-data; name="xml" |
The request body for a post or comment. For JSON, the value of name use "json". For XML, the value of name use "xml". |
| Content-Type |
application/json; charset=UTF-8 application/xml; charset=UTF-8 |
The data format and character set of the request body. For JSON, the value must be application/json. For XML, the value must be application/xml. |
This table describes the HTTP headers and parameters required in the rich input body part of a multipart/form-data request from a web browser.
| HTTP Headers for Rich Input Body Part from Web Browser | Header Value and Parameters | Description |
|---|---|---|
| Content-Disposition | form-data; name="feedElement" | To post a feed element with a binary file (in version 35.0 and earlier), the value of name must be "feedElement". |
| form-data; name="comment" | To post a comment with a binary file, the value of name must be "comment". | |
| form-data; name="photo" | To upload an employee, user, or group photo, the value of name must be "photo". | |
| form-data; name="file" | To upload a file to the Files home or an external repository, the value of name must be "file". | |
| form-data; name="folderItem" | To upload a file to a folder, the value of name must be "folderItem". | |
| form-data; name="ManagedContentInputParam" | To upload a piece of managed content, the value of name must be "ManagedContentInputParam". | |
| form-data; name="ManagedContentVariantInputParam" | To update a managed content variant, the value of name must be "ManagedContentVariantInputParam". |
This table describes the HTTP headers and parameters required in the binary upload body part of a multipart/form-data request.
| HTTP Headers for Binary Upload Body Part | Header Value and Parameters | Description |
|---|---|---|
| Content-Disposition | form-data; name="feedElementFileUpload"; filename=string | To post a feed element with a binary
file (in version 35.0 and earlier), the value of name must be "feedElementFileUpload". To post a comment with a binary file, the value of name must be "feedElementFileUpload". |
| form-data; name="fileUpload" filename=string | To upload a user or group photo, the value of name must be "fileUpload". | |
| form-data; name="fileData" filename=string | To upload a file to the Files home or to upload a file to an external repository, the value of name must be "fileData". | |
| form-data; name="audioFileData" filename=string | To upload an audio file, the value of name must be "audioFileData". If you specify this value, don’t specify recordingURL or name or the request will fail. | |
| form-data; name="contentData" filename=string | To upload a piece of managed content or update a managed content variant, the value of name must be "contentData". | |
| Content-Type | application/octet-stream; charset=ISO-8859-1 | The media type and character set of the binary file. |
Post a feed element with a binary file (version 35.0 and earlier)
Post a batch of feed elements with binary files (version 35.0 and earlier)
Post a comment with a binary file
Post multiple comments with binary files
Include the request body of each subrequest in the richInput properties.
Also include information about the binary parts in the binaryPartName and binaryPartNameAlias properties.