You need to sign in to do that
Don't have an account?
CVSoft
where clause in rest query (php) doens't work
Hi all, I got authentication and a first query ($query1) working, but I don't succeed making a query with a where clause in it ($query2). It results in a Bad Request. Any help is greatly appreciated.
$instance_url = Salesforce_user::get_instance_url($cg_user_id); $name = 'Guido'; $query1 = "SELECT email , name , FirstName FROM LEAD LIMIT 1"; $query2 = "SELECT email ,name, FirstName WHERE FirstName = '$name' FROM LEAD LIMIT 1"; $query_encoded = urlencode($query1); $url = $instance_url . "/services/data/v45.0/query/?q=".$query_encoded; $options['headers']['content-type'] = 'application/json'; $request = ApiController::$provider->getAuthenticatedRequest( 'GET', $url, ApiController::static_oauth_get_access_token($cg_user_id), $options );
Where clause should come after from
try this
$query2 = "SELECT email ,name, FirstName FROM LEAD WHERE FirstName = '$name' LIMIT 1";