• vikash
  • NEWBIE
  • 30 Points
  • Member since 2011

  • Chatter
    Feed
  • 1
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 20
    Replies

I'm trying to use REST APEX API that I created in a dev.Org(A). And I want to use this APEX REST Service in an another Dev Org(B) using REST call to "A" from "B". I cretaed a simple VF page with controller class and some logic inside it to call this serivce.

 

Everything works well till the point i get the "code" value after successful authorization of from "A". But when I try to create a request to get the token/refesh_token part i get a strange error:-  error=unsupported_grant_type&error_description=grant%20type%20not%20supported.

 

following is the piece of code 

 

Http h = new Http();         

HttpRequest req = new HttpRequest();   

req.setMethod('POST');   

req.setHeader('grant_type','authorization_code');       

req.setHeader('code',code);

req.setHeader('client_id',clientId );   

req.setHeader('client_secret',client_secret); 

req.setHeader('redirect_uri',callbackUrl ); 

req.setHeader('Content-Type','application/x-www-form-urlencoded');         

req.setEndpoint('https://login.salesforce.com/services/oauth2/token');            

   

HttpResponse res = null;

res = h.send(req);     

system.debug('###'+res.getBody()+'#####');

Hi all,

 

 

          Can anyone please give  the difference between Force.com sites which were using earlier and Siteforce which is currently offering.

  • September 07, 2011
  • Like
  • 0

Hi everyone,

 

    I am a newbie to FDC (so please correct me if I am wrong anywhere) . I have gone thorugh Apex REST API and found that we can create our custom web services in Apex and expose them as REST services using Apex REST. But in most of the references it is given that we can use any programming language of our choice ( i.e. from outside FDC) to invoke this custom WS via REST API. But I want to invoke the same using Apex code (i.e., from inside FDC) via REST API.

 

Any help is highly appreciated

  • August 25, 2011
  • Like
  • 0

I'm trying to use REST APEX API that I created in a dev.Org(A). And I want to use this APEX REST Service in an another Dev Org(B) using REST call to "A" from "B". I cretaed a simple VF page with controller class and some logic inside it to call this serivce.

 

Everything works well till the point i get the "code" value after successful authorization of from "A". But when I try to create a request to get the token/refesh_token part i get a strange error:-  error=unsupported_grant_type&error_description=grant%20type%20not%20supported.

 

following is the piece of code 

 

Http h = new Http();         

HttpRequest req = new HttpRequest();   

req.setMethod('POST');   

req.setHeader('grant_type','authorization_code');       

req.setHeader('code',code);

req.setHeader('client_id',clientId );   

req.setHeader('client_secret',client_secret); 

req.setHeader('redirect_uri',callbackUrl ); 

req.setHeader('Content-Type','application/x-www-form-urlencoded');         

req.setEndpoint('https://login.salesforce.com/services/oauth2/token');            

   

HttpResponse res = null;

res = h.send(req);     

system.debug('###'+res.getBody()+'#####');

Hi everyone,

 

    I am a newbie to FDC (so please correct me if I am wrong anywhere) . I have gone thorugh Apex REST API and found that we can create our custom web services in Apex and expose them as REST services using Apex REST. But in most of the references it is given that we can use any programming language of our choice ( i.e. from outside FDC) to invoke this custom WS via REST API. But I want to invoke the same using Apex code (i.e., from inside FDC) via REST API.

 

Any help is highly appreciated

  • August 25, 2011
  • Like
  • 0