+ Start a Discussion
Sombir SinghSombir Singh 

services data endpoint issue with sandbox account

For production connection i am using https://login.salesforce.com/services/oauth2/token url to login, after successful login it return an intance URL and based oon that instance url i am fetching the data from salesforce using below query via php curl command : 

$ch = curl_init($this->salesForceInstanceUrl . '/services/data/v24.0/query/?q=' . $query); //Call the sales force query method
            curl_setopt($ch, CURLOPT_HEADER, 0);
            curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
            $jd = json_decode(curl_exec($ch));
            curl_close($ch);

But now i am trying to connect my sandbox account https://cs53.salesforce.com/services/oauth2/token, i am able to login but when fetching data with the same curl commad not getting any results. 

Do i need to changes the servies data end point (services/data/v24.0/query) for sandbox account, if yes where i can found these details.

Thanks in Advance.




 
Amit Singh 1Amit Singh 1
Hello,

You need to get access token for the Sandbox Intance and Instance URL as well and then make the callout.

While making the callout for access token for Sandbox Instance use http://test.salesforce.com/services/oauth2/token

Also, add test.salesforce.com into the Remote Site Setting and then Instance URL after getting the Access Token.

Hope this helps :)
Thanks!
Amit Singh