我需要通过REST API从Salesforce的潜在客户和联系人那里获取数据。在我看到Salesforce不支持 UNION 时,我们需要使用SOSL来获取数据。
为此我使用下面的代码
$url = $instance_url. '/services/data/v37.0/search/?q= FIND {rohit} IN ALL FIELDS RETURNING Lead(email), Contact(email)';
$urlcurl = curl_init($url);
curl_setopt($urlcurl, CURLOPT_HEADER, false);
curl_setopt($urlcurl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($urlcurl, CURLOPT_HTTPGET, 1);
curl_setopt($urlcurl, CURLOPT_HTTPHEADER,
array("Authorization: OAuth $access_token"));
curl_setopt($urlcurl, CURLOPT_SSL_VERIFYPEER, false);
$urljson_response = curl_exec($urlcurl);
$status = curl_getinfo($urlcurl, CURLINFO_HTTP_CODE);
if ( $status != 200 ) {
die("Error: call to URL failed with status $status, response $urljson_response, curl_error " . curl_error($urlcurl) . ", curl_errno " . curl_errno($urlcurl));
}
curl_close($urlcurl);
return json_decode($urljson_response);
但是它会返回一个像
这样的回复Error: call to URL failed with status 400, response , curl_error , curl_errno 0
我怎样才能做到这一点?