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
manimmanim 

API_DISABLED_FOR_ORG error

I have a java web application using chatter REST API to get access to chatter data. I am not able to fetch data from "na10.salesforce.com" due to error "API_DISABLED_FOR_ORG".

 

I have written to Customer support and they are investigating on this. In the meantime, I am using developer instance at "ap1.salesforce.com" and working with XML response returned.

 

I wanted to know whether this is the right way?Will the structure of response XML returned from actual instance will be same as the one returned by developer instance? Thanks for taking time on this. 

Best Answer chosen by Admin (Salesforce Developers) 
cloudcodercloudcoder

Your query works fine (I just pasted in and ran it against my org.)  One thing you may want to try is to use a more current API version. eg: "/services/data/v22.0/query

 

The second part of your problem is related to removing the NewsFeed items from the query

 

All Answers

cloudcodercloudcoder

The Chatter REST API is only currently available in Developer Org's. I suspect you are using this in another edition.

manimmanim

Thanks for replying.
I wanted to understand the difference?
We are using enterprise chatter in our organization?How do I identify whether that is developer's edition?

If that is not developer's edition what do I need to do to get the data from there?

I want to use API to get updates on everything I am following?i.e. response from API call "/chatter/feeds/news/me"

Thanks.

cloudcodercloudcoder

The API is the same regardless of your organization, however right now the Chatter REST API is only enabled in Developer Editions as the API is in Developer Preview.

 

Does that make sense/help?

manimmanim

We had discussion about SOQL API for getting chatter data at below thread:

http://boards.developerforce.com/t5/Chatter-and-Chatter-API/Chatter-REST-API-for-getting-popular-post/td-p/301051

 

Is there any API or SOQL query which will give me the exact data which is returned by an API call "chatter/feeds/news/me"?

If there is any such API ,It would solve my problem.

Please let me now your inputs.

Thanks.

 

 

 

 

 

 

cloudcodercloudcoder

Yes, check out the Chatter Recipes article, recipe 8:

 

http://wiki.developerforce.com/index.php/Chatter_Code_Recipes

manimmanim

I tried recipe 8 at URL  http://wiki.developerforce.com/index.php/Chatter_Code_Recipes

I am facing some problems while executing the query given.Below is code snippet:

 

 

HttpClient httpclient = new HttpClient();
GetMethod get = new GetMethod(bundle.getString("instanceURL") + "/services/data/v20.0/query");

 

  // set the token in the header
 get.setRequestHeader("Authorization", "OAuth " + bundle.getString("accessToken"));

 

String queryText="SELECT Id, Type,CreatedById, CreatedBy.FirstName, CreatedBy.LastName,ParentId, Parent.Name,Body, Title, LinkUrl, ContentData, ContentFileName,(SELECT Id, FieldName, OldValue, NewValue FROM FeedTrackedChanges ORDER BY Id DESC),(SELECT Id, CommentBody, CreatedDate,CreatedBy.FirstName, CreatedBy.LastName FROM FeedComments ORDER BY CreatedDate LIMIT 10),(SELECT CreatedBy.FirstName, CreatedBy.LastName FROM FeedLikes)FROM NewsFeed ORDER BY CreatedDate DESC, Id DESC     LIMIT 20".

 

// set the SOQL as a query param
NameValuePair[] params = new NameValuePair[1];
 params[0] = new NameValuePair( "q", queryText);
 get.setQueryString(params);

 

 

This "get" method when executed returns back response string saying "there no column named body in the NewsFeed"

After removing "body" column from the query it throws same error for columns title, LinkUrl, ContentData, ContentFileName.

 

After removing all columns for NewsFeed from the query it says following:

"Didn't understand relationship 'FeedLikes' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.","errorCode":"INVALID_TYPE"}"

 

What am I doing wrong here?

 

cloudcodercloudcoder

Your query works fine (I just pasted in and ran it against my org.)  One thing you may want to try is to use a more current API version. eg: "/services/data/v22.0/query

 

The second part of your problem is related to removing the NewsFeed items from the query

 

This was selected as the best answer
manimmanim

Yes it worked.I got the data I wanted.

As you suggested ,I changed my API version to latest one.

Thanks a lot for your help.