Query operation not supported for Candidate, please use /search call instead.

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

Moderators: StaffingSupport, s.emmons, BullhornSupport

bahi
User
Posts: 22
Joined: Sun Jun 08, 2014 8:09 pm
Location: London, UK
Contact:

Query operation not supported for Candidate, please use /search call instead.

Postby bahi » Wed May 31, 2017 5:45 pm

Question
Is it possible to use the /query call (page 66 of the REST API docs of May 2017) to search the Candidate entity?

Task
We're trying to find candidates on our Bullhorn account from all but one source and within a date range so that we can sync those records regularly to our company website. The REST API docs suggest that the /query call would be ideal for this because it allows the use of parameters like these:

Code: Select all

?fields=firstName,lastName,email&count=5&BhRestToken=[BH_REST_TOKEN]&where=source<>'Company%20Website'%20AND%20dateAdded>%20[TIMESTAMP]


The response we get asks us to use /search instead of /query.

Query operation not supported for Candidate, please use /search call instead.


We're making the call here:

Code: Select all

https://rest22.bullhornstaffing.com/rest-services/[CODE]/query/Candidate


Background
We currently send candidate info from the website to Bullhorn every 15 minutes: new sign-ups, candidate CV updates, change of candidate details, candidate preferences, etc. We also retrieve some limited information from Bullhorn using the /search call to search candidate records by email address.

The purpose of the code is to also pick up candidate records that recruiters have added manually to Bullhorn and to then give those relevant candidates their login accounts on the company website. It's a small proportion of candidate records but still important. The Bullhorn records we need to pull across have various values for the 'source' field but what they all have in common is that none of them have 'source' set to 'Company Website'.

However simple I make the parameters of the GET/query call, the response is always the same: 'Query operation not supported for Candidate, please use /search call instead.' The response code is 400. It happens when I ask for just three fields and a count of 5 with no other parameters (I’m even leaving out the ‘where’ parameter). I can find a mention of this error here on the forum but no resolution:

https://supportforums.bullhorn.com/viewtopic.php?t=23098

The documentation doesn't suggest that the Candidate entity can't be queried this way. It's the /search call that doesn't list Candidate as a valid entity type in the docs (currently page 88), even though we do use /search against candidate records by email address and it works. What's nice about the /query call is that it allows you to build useful constraints into the call to return only the required records.

Would be very grateful for any pointers or suggestions. I realise I'm probably doing something wrong. Hoping not to have to use /search and download all 70,000+ records every time and cycle through them looking for the relevant data.

Many thanks

Bahi

PS Over the last 24 to 48 hours, I see that we have sometimes been failing to get a rest token after we authorise but the problem above is independent of that – the call is only made after obtaining a valid rest token and session ID.

DaveNorthCreek
User
Posts: 70
Joined: Fri Nov 20, 2015 2:04 pm

Re: Query operation not supported for Candidate, please use /search call instead.

Postby DaveNorthCreek » Wed May 31, 2017 6:45 pm

I am using this query

Code: Select all

//https://rest32.bullhornstaffing.com/rest-services/[CORP]/search/Candidate?query=email:test@test.com&fields=id,email,name&sort=-id&count=10&start=0&...


in production. You get to learn the joys of Lucene queries.

https://lucene.apache.org/core/3_6_2/queryparsersyntax.html

This should work for you (from the above URL):

-

The "-" or prohibit operator excludes documents that contain the term after the "-" symbol.

To search for documents that contain "jakarta apache" but not "Apache Lucene" use the query:

"jakarta apache" -"Apache Lucene"

bahi
User
Posts: 22
Joined: Sun Jun 08, 2014 8:09 pm
Location: London, UK
Contact:

Re: Query operation not supported for Candidate, please use /search call instead.

Postby bahi » Fri Jun 02, 2017 2:58 am

Thanks, Dave. I don’t seem to be able to get the prohibit operator to work when querying the ‘source’ field. Tried the - symbol, as well as ! and NOT but no luck. If I use this, I get 0 results:

Code: Select all

source:[NOT “Company Website”]


The following gets results but they include candidates whose source is “Company Website”:

Code: Select all

source:[-“Company Website”]


With regular parentheses instead of square brackets, I get similar results. With neither, I get syntax errors.

As a workaround, I’m using the ‘OR’ operator and listing every category except the one I want. Not ideal, but it appears to be working, judging by the total returned as I add values to the OR search and cross-check with single-value searches .

Code: Select all

source:(“Source 1” OR “Source 2” OR “Source 3” OR “Source 4”)


(I’m not using curly quotes, BTW—they’re being converted when I post here.)

I have an unrelated problem searching by date range on the dateAdded field. This returns me 33,000+ results:

Code: Select all

dateAdded:[2016-01-01T00:00:00+00:00 TO 2017-05-31T00:00:00+00:00]


Changing the start date from 1st Jan 2016 to 1st Jan 2017 gets me zero results, though we add tens of candidates a day. No other search constraints for this search query—just the date range search against one field.

Code: Select all

/search/Candidate?query=dateAdded:[2017-01-01T00:00:00+00:00 TO 2017-05-31T00:00:00+00:00]&fields=firstName,lastName,email,dateAdded,source

Similar results if I search against dateLastModified.

Index problem, perhaps? I’ll put this into a separate post in case anyone can help. I’ve looked at the date range posts here and the format above does appear to work, and it works for me if I search from 1st Jan 2016. I’ve also tried regular Unix timestamps instead of the ISO 8601 format with similar results. Likewise, using double-quotes around the date values and leaving out the time offset. Suggestions welcome!

Thanks

Bahi

bahi
User
Posts: 22
Joined: Sun Jun 08, 2014 8:09 pm
Location: London, UK
Contact:

Re: Query operation not supported for Candidate, please use /search call instead.

Postby bahi » Fri Jun 02, 2017 2:20 pm

In case anyone lands here after struggling with a date range when using the GET /search call, the answer is to use the YYYYMMDDHHmmSS format for dates when using /search. The format I was using is for the /query call. Details here:

http://supportforums.bullhorn.com/viewtopic.php?f=104&t=23792#p68761


Return to “REST API”

Who is online

Users browsing this forum: No registered users and 1 guest