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
gdsimzgdsimz 

../chatter/feeds/news/me - returns error status 404

Hi There,

 

Attempting to get chatter feeds, messages, etc. and using:

 

..

public void showCurrentUserNewsFeed()
{
fetchChatterFeed(true, "/services/data/v22.0/chatter/feeds/news/me");
}

public void showUserNewsFeed(String userId)
{
fetchChatterFeed(true, "/services/data/v22.0/chatter/feeds/news/"+userId);
}

..

 

 

I can verify I am getting successful authentication because my userid derives from the token as expected.  However none of the example given URLs will return any information from the authenitcated user.

 

This is the validation being used:

 

..

HttpGet get = new HttpGet(url);

get.setHeader("Authorization", "OAuth " + loginResult.getAccessToken());

DefaultHttpClient client = new DefaultHttpClient();
HttpResponse resp = client.execute(get);

if (resp.getStatusLine().getStatusCode() != 200)
{
if (progress != null)
progress.cancel();

errorMsg = "Could not fetch Posts feed: "+url+" status code: "+resp.getStatusLine().getStatusCode();
showDialog(1);
return;
}
String result = EntityUtils.toString(resp.getEntity());

..

 

 instance_url/services/data/v22.0/chatter/feeds/news/me is returning error 404.

 

Thanks for any assistance in advance,

 

Geoff-

alouiealouie

v22.0 isn't supported for the Chatter REST API. Please use v23.0 or higher. The Winter '13 release will be v26.0.

gdsimzgdsimz

Ah thanks.  changing the url line to v23.0 got me farther.  Do you know of a JSON Object reference regarding the supported calls?  For Example, I'm getting an error that itemsFeeds has no value when trying to get that object value:

 

..

JSONObject res = ((JSONObject) new JSONTokener(result).nextValue());
            if (firstPage)
            {    
                errorMsg = "firstPAge flag";
                showDialog(1);
                searchResults = res.getJSONObject("feedItems").getJSONArray("items");
                nextPageURL = res.getJSONObject("feedItems").getString("nextPageUrl");
            }
            else

..

 

Thanks again for your response!

 

Geoff-

alouiealouie

Hi Geoff,

 

I think you want to be using the feed items URL:

 

/services/data/v23.0/chatter/feeds/news/me/feed-items

 

The response body returned from this endpoint is documented here:

 

http://www.salesforce.com/us/developer/docs/chatterapi/Content/connect_returns.htm#cc_feed_item_page

 

and the main source of documentation is at http://www.salesforce.com/us/developer/docs/chatterapi/index.htm

 

Hope that helps. If you're just starting out, I'd suggest using v25.0 (and v26.0 when it becomes available), as these are the newest versions of the API and have improvements over previous versions.

gdsimzgdsimz

Yea I am still having a hard time with this.  However, I think I am making what I need harder than it needs to be from looking back on the attempted examples.  This was original code for a native java app whereas now I am asked to have a section on an intranet site show the chatter site for someone logged in.  I don't think I need anything custom as to merely embedded the platform onto an existing site.  Have you seen any noobie examples to just getting a login with the normal newsfeed and activity (like the center column when logging into the chatter.com site)?