• Benedict
  • NEWBIE
  • 0 Points
  • Member since 2012

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 7
    Questions
  • 10
    Replies

Hi, I am developing a website for chatter users. I want to show their profile image regardless whether the user has an active session to salesforce or not.

After reading http://blogs.developerforce.com/developer-relations/2011/03/accessing-chatter-user-pics.html, I tried  "photolUrl" + "?oauth_token=" + access_token for getting the photo.

Specifically, the "photoUrl" includes the one returned from a "feedItem",  and "largePhotoUrl" "smallPhotoUrl" from a "userId/photo".

I tried to put the combined URL directly in html like this:

<img src=combinedURL> </img>

 

I tried as well as to download the image first in the server and then serve it to the user. The following java code is used in a servlet:

 

URL url = new URL(photoUrl + "?oauth_token=" + this.getAccessToken());
BufferedInputStream in = new BufferedInputStream(urlConnection.getInputStream());
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream("image.png"));
int i;
while ((i = in.read()) != -1) {
out.write(i);
}
out.flush();
out.close();
in.close();

 However, none of the above gives correct result. The download code works on google logo image, but it doesn't work on the combined url

 Can anybody help me?

 

Hi, I am doing OAuth in this simple HTML page:

 

<%@page import="static rest.RESTApp.*"%>
<html>
    <body onLoad="document.authorizationForm.submit()">
    <form action="<%=currentREST.getAuthURL()%>" method="post" name="authorizationForm">    
      <input type="hidden" name="response_type" value="code"/>    
      <input type="hidden" name="client_id" value="<%=currentREST.getClient_id()%>"/>
      <input type="hidden" name="redirect_url" value="<%=currentREST.getRedirect_url()%>"/>
    </form>
    </body>
</html>

 

I am getting an error "error=redirect_uri_mismatch&error_description=redirect_uri%20must%20match%20configuration" from salesforce server.

However, I checked several times the redirectURL and I am sure it is the same as in the REMOTE ACCESS configuration.

 

Can anyone tell me what am I doing wrong?

 

I am using the following html page as the login page for my REST app. But I am getting consistently the redirect_url mismatch error. I have checked the url and I am sure that the url string is correct. I have also tried other urls but the error keeps popping up. What am I doing wrong?

 

<html>
    <body> <%-- onLoad="document.authorizationForm.submit()">  --%>
    <form action="https://login.salesforce.com/services/oauth/authorize" method="post" name="authorizationForm">    
      <input type="hidden" name="response_type" value="code"/>    
      <input type="hidden" name="client_id" value="3MVG9rFJvQRVOvk6sl7xMXtrbyQb2XUv2vprLKWv0uxBLKFzNqtHJG6cmzuemPYDB3hPwqXsBlw0BGQPkb81P"/>
      <input type="hidden" name="redirect_url" value="https://10.132.35.240:8443/"/>
    </form>
  </body>
</html>

 

 

 

error=redirect_uri_mismatch&error_description=redirect_uri%20must%20match%20configuration

Tried Bulk API, but cannot run SOQL directly on FeedLike table.

RestAPI will do but that would require separate calls to each feeditem, so it will not be efficient.

 

Is there any way to get all the feedlikes within one call (Something in the form of bulkAPI) ?

Hi, I am trying to get the access token in Java and following the instructions on http://www.salesforce.com/us/developer/docs/chatterapi/index.htm
But I continuously get this error:

{"error":"unsupported_grant_type","error_description":"grant type not supported"}

 

My codes are here:

 

 

package admin;

 

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

 

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.json.simple.JSONObject;
import org.json.simple.JSONValue;

 

import com.google.gson.Gson;

 

public class REST
{
String authURL = "https://login.salesforce.com/services/oauth2/authorize";
String tokenURL = "https://na14.salesforce.com/services/oauth2/token";
public static void main(String[] args) throws ClientProtocolException, IOException
{
REST rest = new REST();
}

public REST() throws ClientProtocolException, IOException
{
HttpClient httpclient = new DefaultHttpClient();
HttpPost post = new HttpPost(tokenURL);
post.getParams().setParameter("client_id", "3MVG9rFJvQRVOvk6sl7xMXtrbyQb2XUv2vprLKWv0uxBLKFzNqtHJG6cmzuemPYDB3hPwqXsBlw0BGQPkb81P");
post.getParams().setParameter("client_secret", "4864720658246552438");
post.getParams().setParameter("grant_type", "password");
post.getParams().setParameter("username", "XXXX");
post.getParams().setParameter("password", "XXXX");
post.getParams().setParameter("redirect_uri", "https://login.salesforce.com/services/oauth2/success");
HttpResponse response = httpclient.execute(post);
JSONObject json = (JSONObject) JSONValue.parse(new InputStreamReader (response.getEntity().getContent()));
System.out.println(json);
}
}

 

Hi, I am a new Chatter App developer and I am trying to extract interactions between Chatter users in my organization.

The "@" or mention information is very important for my App, but it seems there is no documentation about how to get "@" information neither in SOQL nor in REST.

Can anybody tell me how to access "@" information? Many thanks in advance!

 

(I posted this in the Chatter Development section too. Sorry for duplication, but I'm not sure which board this question belongs to. If anybody knows where this question should goto, I'll be happy to move/delete duplications.)

Hi, I am a new Chatter App developer and I am trying to extract interactions between Chatter users in my organization.

The "@" or mention information is very important for my App, but it seems there is no documentation about how to get "@" information neither in SOQL nor in REST.

Can anybody tell me how to access "@" information? Many thanks in advance!

Hi, I am doing OAuth in this simple HTML page:

 

<%@page import="static rest.RESTApp.*"%>
<html>
    <body onLoad="document.authorizationForm.submit()">
    <form action="<%=currentREST.getAuthURL()%>" method="post" name="authorizationForm">    
      <input type="hidden" name="response_type" value="code"/>    
      <input type="hidden" name="client_id" value="<%=currentREST.getClient_id()%>"/>
      <input type="hidden" name="redirect_url" value="<%=currentREST.getRedirect_url()%>"/>
    </form>
    </body>
</html>

 

I am getting an error "error=redirect_uri_mismatch&error_description=redirect_uri%20must%20match%20configuration" from salesforce server.

However, I checked several times the redirectURL and I am sure it is the same as in the REMOTE ACCESS configuration.

 

Can anyone tell me what am I doing wrong?

 

Has anybody develoeped Chatter REST API client?

I am actually trying to understand how to get OAuth access token.

 

Do I need to have an HTTPS website in order to specify a redirect URL where I can get access token?

 

I am developing a client application that may be used by many different SFDC orgs, in that case I have to manually generate OAuth for every SFDC org and setup the access token in the application?

 

How can I automate the process of getting OAuth token?

My client applicaiton is headless (no GUI).

 

Thanks,

Bakul

Hi, I am trying to get the access token in Java and following the instructions on http://www.salesforce.com/us/developer/docs/chatterapi/index.htm
But I continuously get this error:

{"error":"unsupported_grant_type","error_description":"grant type not supported"}

 

My codes are here:

 

 

package admin;

 

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

 

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.json.simple.JSONObject;
import org.json.simple.JSONValue;

 

import com.google.gson.Gson;

 

public class REST
{
String authURL = "https://login.salesforce.com/services/oauth2/authorize";
String tokenURL = "https://na14.salesforce.com/services/oauth2/token";
public static void main(String[] args) throws ClientProtocolException, IOException
{
REST rest = new REST();
}

public REST() throws ClientProtocolException, IOException
{
HttpClient httpclient = new DefaultHttpClient();
HttpPost post = new HttpPost(tokenURL);
post.getParams().setParameter("client_id", "3MVG9rFJvQRVOvk6sl7xMXtrbyQb2XUv2vprLKWv0uxBLKFzNqtHJG6cmzuemPYDB3hPwqXsBlw0BGQPkb81P");
post.getParams().setParameter("client_secret", "4864720658246552438");
post.getParams().setParameter("grant_type", "password");
post.getParams().setParameter("username", "XXXX");
post.getParams().setParameter("password", "XXXX");
post.getParams().setParameter("redirect_uri", "https://login.salesforce.com/services/oauth2/success");
HttpResponse response = httpclient.execute(post);
JSONObject json = (JSONObject) JSONValue.parse(new InputStreamReader (response.getEntity().getContent()));
System.out.println(json);
}
}