• Esha Sharma 3
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 9
    Replies
When I am trying to query custom Object, I am getting below error:

ERROR at Row:1:Column:16

sObject type 'RCA__C' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.

Access Custom Object:

  qr = binding.query("SELECT ID from RCA__C limit 1");
 
Hi Guys,

I am trying to hit below URL to use Attachments API and I am getting BAD Request. Can you help me with the right URL and point out if anything is missed.

builder = new PostMethod("https://gus,salesforce.com/" + "/services/data/v20.0/sobjects/Attachment/");
builder.setRequestHeader("Authorization","OAuth " + lr.getSessionId()); 
httpclient.executeMethod(builder);
System.out.println(builder.getStatusText());   << throws Bad Request
When I am trying to query custom Object, I am getting below error:

ERROR at Row:1:Column:16

sObject type 'RCA__C' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.

Access Custom Object:

  qr = binding.query("SELECT ID from RCA__C limit 1");
 
Hi Guys,

I am trying to hit below URL to use Attachments API and I am getting BAD Request. Can you help me with the right URL and point out if anything is missed.

builder = new PostMethod("https://gus,salesforce.com/" + "/services/data/v20.0/sobjects/Attachment/");
builder.setRequestHeader("Authorization","OAuth " + lr.getSessionId()); 
httpclient.executeMethod(builder);
System.out.println(builder.getStatusText());   << throws Bad Request
Hi All,

I am trying to connect one sf org to anaother. I am using the below class to initiate the call from command button. I copied session id of target org and hard coded here in the class which then worked. But for next time it expires and i get invalid session id.

Can anyone help me out how i can dynamically have the session id of source org, so that i need not to hard code it.

public class Apex_Rest_DemoController {
    
    public String response{get;set;}
    public String accName{get;set;}
    public String accPhone{get;set;}
    public String accWebsite{get;set;}
    
    public PageReference CreateAccount() {
        //find access token using Auth 2.0 
       String Access_Token = '00D28000000Heme!AQ8AQAFOnSjXlGvbNT9JXj5vcC2XjQyFtz8ls_x0IMmoDuX91WDLvb9j5qficiTwQpCGjTYIRCUOmvwQOlWvP2.0HPA3x9M.';
       
        Httprequest req=new httprequest();
        String domainName='ap2.salesforce.com';

        String endPointURL='https://'+domainName+'/services/data/v34.0/sobjects/Account';
        req.setendpoint(endPointURL);
        req.setHeader('Content-Type', 'application/xml; charset=utf-8');
        req.setBody('<?xml version="1.0" encoding="UTF-8" ?><request><name>'+accName+'</name><phone>'+accPhone+'</phone><website >'+accWebsite+'</website > </request>');
        req.setmethod('POST');
        req.setHeader('Authorization','Authorization: Bearer '+Access_Token);
        //req.setHeader('Authorization','Bearer '+Access_Token);
        //req.setHeader('Authorization', 'OAuth '+UserInfo.getSessionId());
        Http http = new Http();
        HTTPResponse res = http.send(req);
        response=res.getbody();
        System.debug('****************res.getStatusCode();'+res.getStatusCode());
        System.debug('****************res.getbody();'+res.getbody());
        return null;
    }
}

Regards

I am using cUrl to test out the REST api. I am not using OAuth  to get the token. I am using the

curl https://test.salesforce.com/services/Soap/c/23.0/xxxxxxxxxx-H "Content-Type: text/xml; charset=UTF-8" -H "SOAPAction: login" -d @login.txt

 

to get the session id.

 

Then I am trying to use the session id as mentioned in the REST Api quick start guide. Though I am kind of confused what url I should be using to request Resources?

 

Thanks,

Janak.