Newer Version Available
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.
- application/json
- application/xml
Uploading Binary Files
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. |
| HTTP Headers for Rich Input Body Part from Web Browser | Header Value and Parameters | Description |
|---|---|---|
| Content-Disposition |
form-data; name="feedElement"
form-data; name="comment" form-data; name="photo" form-data; name="file" |
To post a feed element with a binary file (in version 35.0 and earlier), the
value of name must be "feedElement". To post a comment with a binary file, the value of name must be "comment". To upload an employee, user, or group photo, the value of name must be "photo". To upload a file to the Files home or an external repository, the value of name must be "file". |
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". | |
| 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.