Rest API - query by DateAdded

Forum for users and developers of Bullhorn's API service.

Moderators: StaffingSupport, s.emmons, BullhornSupport

Post Reply
canferagm
User
Posts: 1
Joined: Tue Feb 18, 2020 2:29 am

Rest API - query by DateAdded

Post by canferagm »

Hi, I am new to this forum and also new working with the Bullhorn Rest API, so thanks in advance for your valuable help!

I have successfully connected with the API and I am returning records according to queries but when I try to return placement records equal or higher than a specific date I have no data returned, but if I try to run the same query directly in the internet browser (chrome) it works well and return data. See below the code I am using.

$date = new DateTime('01/01/2020'); // format: MM/DD/YYYY - Example
$da = $date->format('U');

$url = $session->restUrl.'query/Placement?fields=id,status,jobOrder(id,clientCorporation(id,name,phone)),candidate,dateAdded&where=dateAdded>='.$da.'&count=100&sort=-dateAdded&BhRestToken='.$session->BhRestToken;

//$url value when debugging => https://rest42.bullhornstaffing.com/rest-services/5102s0/query/Placement?fields=id,status,jobOrder(id,clientCorporation(id,name,phone)),candidate,dateAdded&where=dateAdded>=1577865600&count=100&sort=-dateAdded&BhRestToken=b8c6064d-b5bf-4b71-af69-26c4e91b30a2

$curl = curl_init( $url );
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_BINARYTRANSFER, true);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);


$content = curl_exec( $curl );
curl_close( $curl );

Thanks in advance for any help on this topic
Post Reply