Getting started

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

Moderators: StaffingSupport, s.emmons, BullhornSupport

Post Reply
enapoleone
User
Posts: 28
Joined: Sat Nov 17, 2012 12:06 am

Getting started

Post by enapoleone » Fri Jan 04, 2013 12:16 pm

Hello,

I'm just getting started with using Bullhorn's REST API and I'd like to get the opinion of experienced users what they consider the best approach.

To start with my client used the HTTP method previously and the most common things they did via their website are: display all jobs and allow candidates to apply for jobs.

I'm interested to know what procedures I'd use to perform those requests.

Thanks!

John

enapoleone
User
Posts: 28
Joined: Sat Nov 17, 2012 12:06 am

Re: Getting started

Post by enapoleone » Fri Jan 04, 2013 1:48 pm

So I've decided to try the API entity operation to get all the jobs. With my corporation_token and my session_key I make the following GET request

Code: Select all

https://rest2.bullhornstaffing.com/rest-services/[corporation_token]/entity/JobOrder?BhRestToken=[session_key]&fields=*
And I receive the following response:

Code: Select all

{
  "errorMessage" : "unknown or badly structured command: /entity/JobOrder."
}
I'm not sure if this is the correct approach. I'll keep trying other approaches and report back.

enapoleone
User
Posts: 28
Joined: Sat Nov 17, 2012 12:06 am

Re: Getting started

Post by enapoleone » Fri Jan 04, 2013 2:22 pm

I am getting more results using the query operation than the entity. Still not sure if this is the best approach but at least I am getting some results.

There are what seem to be some mistakes in the Documentation (BullhornRESTAPI.pdf).

1. On page 29, under 'Required' in the 'where' row the link 'Query where parameter' is broken but can be found on page 31.
2. Under JobOrder, on page 91, the 'isDeleted' values are either 'true' or 'false' (no quotes) and not 1 or 0

enapoleone
User
Posts: 28
Joined: Sat Nov 17, 2012 12:06 am

Re: Getting started

Post by enapoleone » Sun Jan 06, 2013 9:22 pm

So I'm having the best success with the query operation. When I plug my URL in the Google Chrome extension 'Simple REST Client' the query works just fine.

When I take the same URL and plug it into my PHP script I get an error that the 'fields' parameter is missing. I am attempting to write a Drupal module and am using the drupal_http_request($url,$options) (http://api.drupal.org/api/drupal/includ ... _request/7) function as my HTTP Request method. It should be enough, in fact I use it to refresh the Rest Token and get the Session Key successfully.

Code: Select all

$url = 'https://rest2.bullhornstaffing.com/rest-services/[corporation_token]/query/JobOrder?BhRestToken=[session_key]&where=isDeleted=%20false%20AND%20status='Accepting Candidates'&fields=id,address,categories(name),clientBillRate,dateAdded,description,publicDescription,skillList,title';

$options['method'] = 'GET';

$result = drupal_http_request($url,$options);
Result:

Code: Select all

{
  "paramName" : "'fields' or 'layout'",
  "errorMessage" : "missing parameter: 'fields' or 'layout'"
}
As far as I'm concerned it's pretty obvious that there is a fields parameter. Does anyone have any ideas?

enapoleone
User
Posts: 28
Joined: Sat Nov 17, 2012 12:06 am

Re: Getting started

Post by enapoleone » Mon Jan 07, 2013 4:05 pm

Okay so I'm getting results through my application and the following is what I figured out.

Despite what the documentation examples say it looks like all spaces have to be URL encoded therefore the following works:

Code: Select all

https://rest2.bullhornstaffing.com/rest-services/[corporation_key]/query/JobOrder?BhRestToken=[session_key]&fields=id,address,categories(name),clientBillRate,dateAdded,description,publicDescription,skillList,title&where=isDeleted=%20false%20AND%20status='Accepting%20Candidates'
Notice that 1. I've changed the order of parameters and moved 'fields' before 'where', this is not an issue and will work both ways 2. the issue is that the space between 'Accepting Candidates' needs to be URL encoded. Therefore, the URL in my previous post in this thread was blowing up after the missing space, effectively removing the 'field' parameter from the query. As a result I got the error 'missing parameter: 'fields'...'

Furthermore, attempting to URL encode each paramater does not work either...I tried.

I hope that this helps someone.

c.choy
User
Posts: 49
Joined: Wed Dec 31, 1969 8:00 pm

Re: Getting started

Post by c.choy » Mon Jan 07, 2013 6:36 pm

Hi,

Sorry, apparently got to this a bit late and you already resolve the issue. Yes, you'll want to encode the url, spaces and other characters will cause issues, so * or ' would be another case.
I was able to make use of http_build_query to append the parameters which will perform the url encoding.

I'll mention the document errors you've noted to get them updated as well, thank you for that.

jason
User
Posts: 5
Joined: Wed Jan 09, 2013 11:14 pm

Re: Getting started

Post by jason » Thu Jan 10, 2013 2:09 am

This is enormously helpful, thanks for posting. I have a related question, I'm having trouble adding additional parameter to filter the search. this isn't working, can somebody lead me in the right direction?

The main problem is that in the API docs PDF file it has a link to explain the "where" query syntax, however it goes to a broken link here: "http://confluence/display/DEV/Query+where+parameter" - so it's basically impossible to help myself figuring out the syntax for a where statement.

Here's my code:

$where = "where=isDeleted=%20false%20AND%20status='Accepting%20Candidates%20AND%20publicDescription%20like%20'" . urlencode('%'.$query.'%') . "'

there error i'm getting is "viable alternative at input 'LIKE'"

Thanks for any help

enapoleone
User
Posts: 28
Joined: Sat Nov 17, 2012 12:06 am

Re: Getting started

Post by enapoleone » Thu Jan 10, 2013 11:30 am

Hi Jason,

I went through urlenconding parameters and it was not always so successful. The one thing that I figured out is that spaces absolutely need to be urlencoded. Therefore You might have to play around with the the special characters in the value for $query. I understand that it will be dynamic but you might want to test something hardcoded first.

Also, I think that there's a syntax error in your query string at: status='Accepting%20Candidates%20' < it's missing the closing single quote. Not sure if you copied this from your code or typed it out.

Please let us know what you figure out.

John

jason
User
Posts: 5
Joined: Wed Jan 09, 2013 11:14 pm

Re: Getting started

Post by jason » Thu Jan 10, 2013 3:59 pm

Thanks John. I'm fairly sure my urlencoding is all good. The error message indicates that LIKE is not supported in a query. So that makes sense. Have you successfully done any keyword search queries?

Just a simple case - I want to search for all JobOffers where the subject contains 'ruby'. Surely there must be a way to do that? The docs mention * and ? are possible wildcard characters. Using the find (fastFind) method I've gotten search terms to work, but then it returns not only JobOffers but also Candidates as well which is not useful. And then it still doesn't seem to search the title of the JobOrder.

This API is a strange beast, I have to say.

s.potnis
User
Posts: 16
Joined: Wed Dec 31, 1969 8:00 pm

Re: Getting started

Post by s.potnis » Tue Jan 15, 2013 5:16 pm

Hi Jason,

To retrieve jobs that have the word ruby in them you can run a query such as

https://rest4.bullhornstaffing.com/rest ... [RestToken]

I ran this query to look for jobOrders that contain the word Test in them and was successful in pulling back results.

Thanks,

Soniya

LishaZen22
User
Posts: 2
Joined: Tue Oct 28, 2014 8:07 am

Re: Getting started

Post by LishaZen22 » Tue Oct 28, 2014 9:52 am

I'm also a newbie. Sharing your thoughts and ideas can help a lot.
Lisha
Check out this great dream dictionary website which analyzes many dreams to reveal what our dreams mean. Try www.dreamdictionarynow.com for the answers to your dreams meanings and what the popular dreams mean.

Ada355
User
Posts: 2
Joined: Wed Apr 01, 2015 1:20 am

Re: Getting started

Post by Ada355 » Wed Apr 01, 2015 1:27 am

Hi! I am new here. Thanks for the information you're sharing here.
Ada

Post Reply