Code Monkey home page Code Monkey logo

bullhorn's Introduction

bullhorn

Quick access to the Bullhorn api

Automation

To cache Bullhorn's jobs to a JSON file on a server for fast access, use the save-jobs. This can be automated on a Linux server useing a cron task.

Example cron:

# Update jobs just before the hour...
55 * * * * /home/user/project/save-jobs

A jobs.json file is created within the data directory.

Filtering the jobs.json file.

In order to retrieve the jobs for use on a website or elsewhere, use the filter command. The first argument to filter is the name of the data to filter upon. For example, to retrieve ALL jobs:

filter jobs

In order to only retrieve specific jobs that match given criteria, pass in the search terms via CLI arguments. For example:

filter jobs isOpen=true # only returns jobs classed with this flag set to true.
filter jobs address/city=Derby # notice the use of nested properties.

Uploading a CV

Once there is a file uploaded through PHP, there are two enpoints that need to be called. Firstly, a new "candidate" needs creating, then the CV file needs uploading to Bullhorn.

To create a candidate, pass the first and last names of the POSTed data to the entity/Candidate endpoint, which will return the ID of the newly created candidate.

With the candidate's ID, sent the uploaded CV file to the file/Candidate endpoint along with the candidate's ID.

Below is an example flow of how to handle this. The snippet assumes your script has the $firstName, $lastName and $filePath variables set. This can be done by accessing the $_POST and $_FILES globals.

$firstName = $_POST["firstName"];
$lastName = $_POST["lastName"];
$filePath = $_FILES["cv"]["tmp_name"];

exec("api/endpoint.php PUT entity/Candidate firstName=$firstName lastName=$lastName name=$firstName\ $lastName", $outputLines);

$jsonResponse = json_decode(implode("\n", $outputLines));

$newCandidateID = $jsonResponse->changedEntityId;

$outputLines = [];
exec("api/endpoint.php PUT file/Candidate/$newCandidateID/raw externalID=Portfolio fileType=SAMPLE --file=$filePath", $outputLines);

$jsonResponse = json_decode(implode("\n", $outputLines));

// Check the success:
if(!isset($jsonResponse->fileId)) {
  die("Something went wrong...");
}

When a file is uploaded on your server, it will likely be placed in the system's /tmp directory.

API usage

Authenticate

To authenticate, ready to call any endpoint, run api/auth.php. It will list out the files required to store credentials (ID, secret, etc).

Endpoint

Once authenticated, simply run api/endpoint.php and pass in the arguments. The first argument should be the API endpoint (the part after the corporation token). The script will pass back the JSON response from the API.

For example:

api/endpoint.php GET query/JobOrder fields=title where=isOpen=true count=100 start=0

will call a URL similar to:

https://restX.bullhornstaffing.com/rest-services/12345/query/jobOrder?fields=title&where=isOpen=true&count=100&start=0&&BhRestToken=acbdefg-1234-5678-0000-80170f515268

Output:

{
  "start" : 0,
  "count" : 8,
  "data" : [ {
    "title" : "Test Vacancy 4 Greg"
  }, {
    "title" : "Test vacancy"
  }, {
    "title" : "Planned Maintenance Team Leader"
  }, {
    "title" : "Software Test Engineer / Software Engineer in Test"
  }, {
    "title" : "Test Vacancy - Engineering"
  }, {
    "title" : "Senior PHP Developer"
  }, {
    "title" : "Retail Logistics Manager"
  }, {
    "title" : "Mechanical Maintenance Engineer"
  } ]
}

Other notable examples:

api/endpoint.php PUT entity/Candidate firstName=Test lastName=Testerson name=Test\ Testerson

Creates a new candidate by name. Returned is the candidate's ID:

{
  "changedEntityType" : "Candidate",
  "changedEntityId" : 12345,
  "changeType" : "INSERT"
}

With this ID you can upload a CV and associate it:

api/endpoint.php PUT file/Candidate/12345/raw externalID=Portfolio fileType=SAMPLE --file=/path/to/cv.doc

bullhorn's People

Contributors

g105b avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.