Simple REST client for the Bullhorn API, including automated OAuth2 login
Currently in beta status.
Provides a simple client for the Bullhorn REST API.
$ composer require jonathanraftery/bullhorn-rest-client
use jonathanraftery\Bullhorn\Rest\Client as BullhornClient; $client = new BullhornClient( 'client-id', 'client-secret' ); $client->initiateSession( 'username', 'password' );
Simple requests as documented in the Bullhorn API documentation can be run as:
$response = $client->request( 'GET', 'search/JobOrder?query=id:7777' );
The client uses GuzzleHTTP for requests, and the parameters to the request method match those to create a request object in Guzzle. The third parameter is the request options, as described in the Guzzle documentation.
To set the body of a PUT/POST request, set the "body" option of the request to the JSON content of the request body such as:
$response = $client->request( 'PUT', 'entity/Candidate', [ 'body' => json_encode(['firstName' => 'Alanzo', 'lastName' => 'Smith', 'status' => 'Registered']) ] );
More complex requests can be used for specific entities. The following will retrieve all job orders matching isDeleted:false.
If there are more job orders than Bullhorn will return in one request, the client will automatically make multiple requests and return the concatenated array of all job orders.
$luceneConditions = 'isDeleted:false'; $fields = ['id','name','dateAdded']; // ['*'] = all fields, default is ['id'] $jobOrders = $client->JobOrders->search($luceneConditions, $fields);
Currently, only job order entities are supported. The Resources/JobOrders class can be used as a reference of how to create others.
Session will automatically refresh if expiration detected, or can be refreshed manually (shown with optional parameters)
$client->refreshSession(['ttl' => 60]);