Activity Forums Salesforce® Discussions Using SOQL queries in REST API request - Salesforce

  • Using SOQL queries in REST API request - Salesforce

    Posted by Kumar on December 13, 2016 at 8:04 am

    Hi everybody,

    I am trying to fetch Accounts from another salesforce org by using a httprequest instance. I have obtained the security token from the other org , my code extract for the query is as follows:

    {httprequest req = new httprequest();
    http testHttp = new http();

    req.setMethod('GET');
    req.setEndPoint('https://ap2.salesforce.com/services/data/v38.0/query/?q=SELECT id,Name FROM Account');
    req.setHeader('Authorization','OAuth *Here is the token*');
    HttpResponse res = testHttp.send(req); }

    But it is giving me Error Code: 400

    Any suggestions?? Thanks

    sushant replied 7 years, 10 months ago 2 Members · 1 Reply
  • 1 Reply

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos