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
ugougo 

News Feed Items payload

Hi,

 

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
Host: na15.salesforce.com
Content-Length:

 

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

This is the content of the file.
--0HWq8x4y4DSQ4fqjXt6MinVMyqbf1r

 

 

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,

Ugo

jody_blyjody_bly

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

http://www.salesforce.com/us/developer/docs/chatterapi/Content/intro_input.htm

 

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

www.salesforce.com/us/developer/docs/chatterapi/Content/connect_resource_feeds_news.htm#cc_news_feed_items_title

 

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.