function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

News Feed Items payload



I am having some difficulty figuring out the payload for a News Feed Item request with file attachment. Is the following correct?:


POST /services/data/v27.0/chatter/feeds/news/me/feed-items?attachmentType=NewFile&title=testFile HTTP/1.1
Content-Type: multipart/form-data; boundary=0HWq8x4y4DSQ4fqjXt6MinVMyqbf1r
Authorization: Bearer 00D...Wo

Accept: application/xml
User-Agent: Jakarta Commons-HttpClient/3.1


Content-Disposition: form-data; name="feedItemFileUpload"; filename="testFile"
Content-Type: application/octet-stream; charset=ISO-8859-1

This is the content of the file.



Is it ok to put the parameters "attachmentType" and "title" in the query string as I did above?


What would be the corresponding payload if I wanted to put all the parameters in the body instead?


Thank you,



The first example on this page should show you what you need:


The parameters for posting a new file to a news feed are here:


It is OK to put the parameters in the query string. Or you can put them in the body (see examples in the links). If you put them in both places, the query parameters are usually ignored.