PHP code example of justijndepover / bullhorn-api

1. Go to this page and download the library: Download justijndepover/bullhorn-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

justijndepover / bullhorn-api example snippets


// note the state param: this can be a random string. It's used as an extra layer of protection. Bullhorn will return this value when connecting.
$bullhorn = new Bullhorn(CLIENT_ID, CLIENT_SECRET, REDIRECT_URI, STATE);

// if you already possess authentication credentials, provide them:
$bullhorn->setAccessToken($accessToken);
$bullhorn->setRefreshToken($refreshToken);
$bullhorn->setTokenExpiresAt($expiresAt);
$bullhorn->setRestUrl($restUrl);
$bullhorn->setBHRestToken($BHRestToken);

// when one of the tokens (accesstoken, refreshtoken, BHRestToken) changes, a callback method is called. Giving you the opportunity to store them.
$bullhorn->setTokenUpdateCallback(function ($bullhorn) {
    // you should store away these tokens
    $bullhorn->getAccessToken();
    $bullhorn->getRefreshToken();
    $bullhorn->getTokenExpiresAt();
    $bullhorn->getRestUrl();
    $bullhorn->getBHRestToken();
});

// open the connection
$bullhorn->connect();

$bullhorn->get('entity/Candidate/5059165');