Login request sometimes returns 400 - 'Bad Request' error

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

Moderators: StaffingSupport, pmularski, BullhornSupport

Post Reply
spoissant
User
Posts: 5
Joined: Thu May 18, 2017 3:03 pm

Login request sometimes returns 400 - 'Bad Request' error

Post by spoissant »

Hello,

We have an integration with Bullhorn API for one of our client that essentially polls Bullhorn for events every minute or so.

About every 5 minutes, we invoke
oauth/token?grant_type=refresh_token&refresh_token={Settings.RefreshToken}&client_id={Settings.ClientId}&client_secret={Settings.ClientSecret}
to refresh our Access and Refresh Tokens then call
rest-services/login?version=*&access_token={Settings.AccessToken}
to log in again to the Bullhorn API.

Every now and then, our Refresh call fails with the following result:

Code: Select all

StatusCode: 400, ReasonPhrase: 'Bad Request', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
  Pragma: no-cache
  Connection: close
  Cache-Control: no-store
  Date: Thu, 07 Sep 2017 18:14:53 GMT
  Server: Apache-Coyote/1.1
  Content-Length: 102
  Content-Type: application/json; charset=UTF-8
}
And every now and then also our Login call will fail with the following similar result:

Code: Select all

StatusCode: 400, ReasonPhrase: 'Bad Request', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
  Connection: close
  Transfer-Encoding: chunked
  Date: Tue, 05 Sep 2017 19:22:19 GMT
  Server: Apache-Coyote/1.1
  Via: 1.1 default
  Content-Type: application/json; charset=UTF-8
})
When that happens our code will automatically Refresh the Access Token again and re-try to log in. Usually after 2-3 tries it finally succeeds but we've had cases where after 4 attempts (that's the max we've set) we still were not able to log in .

Is that a known issue? Is there workarounds other then increasing the amount of retries?
spoissant
User
Posts: 5
Joined: Thu May 18, 2017 3:03 pm

Re: Login request sometimes returns 400 - 'Bad Request' error

Post by spoissant »

For anyone looking for an answer to this problem,

I got in touch with a Bullhorn Tech Support and it appears this is a problem that can occur.

For now we will be increasing the retries count (to 12) and adding a small delay between each retries.

If I ever come up with or receive a better solution I'll post it here.
Post Reply