Getting Error Back from AttachFile.cfm

Have a question about Bullhorn's HTTP based APIs? You've found the right place.

API Update [posted on December 13, 2012]:

This version of the Bullhorn APIs should no longer be used.

All new work should be done using Bullhorn's REST or Web Services APIs. For more information please visit: http://developer.bullhorn.com/documentation

Bullhorn REST API provides a simpler and faster way for developers to build applications that interact with the Bullhorn platform and is used by Bullhorn Inc. to develop features of the Bullhorn ATS/CRM application.

Of the BullhornSTAFFING HTTP API interfaces listed below, our analysis shows that the following are most commonly used by developers:

Resume Parsing API
Published Job Data (XML)
The interface to these will continue to work as is because Bullhorn will replace the back end to use REST API. The URLs for these 2 specific APIs may change in the 2nd half of 2013; developers may require to update their applications to use the new URLs.

Moderators: StaffingSupport, s.emmons

Locked
lukef
User
Posts: 7
Joined: Wed Dec 01, 2010 12:03 am

Getting Error Back from AttachFile.cfm

Post by lukef » Thu Jan 27, 2011 1:38 am

Hi

I'm been having some trouble today with the legacy API and attaching files to candidates. This previously hasn't been a problem so I'm a little perplexed. Nevertheless I've gone hunting around and she's working again but I am getting the following error back in the cURL response:

Code: Select all

Caught an exception, type = Expression

cannot convert the value "" to a boolean

The contents of the tag stack are:

1 CF_CAST (323,0) C:\jrun4\servers\Bullhorn_1\cfusion-ear\cfusion-war\BullhornSTAFFING\API\AttachFile.cfm
2 CF_ATTACHFILE (88,0) C:\jrun4\servers\Bullhorn_1\cfusion-ear\cfusion-war\BullhornSTAFFING\API\AttachFile.cfm
3 CF_ATTACHFILE (1,0) C:\jrun4\servers\Bullhorn_1\cfusion-ear\cfusion-war\BullhornSTAFFING\API\AttachFile.cfm 
The data I am submitting is
* our Private Label ID
* our Encrypted API Key
* the user ID
* the file
* and FALSE for updateResumeOverview

I've tried multiple user IDs and multiple files but I still get this error in the response. Have there been any changes on the Bullhorn end regarding this piece of the Legacy API?

lukef
User
Posts: 7
Joined: Wed Dec 01, 2010 12:03 am

Re: Getting Error Back from AttachFile.cfm

Post by lukef » Thu Jan 27, 2011 2:32 am

Also, I've just found that if I change the encrypted api key to something incorrect, I get back an error string via curl_error() but the curl_errno() is still '0' - meaning success (http://curl.haxx.se/libcurl/c/libcurl-errors.html).

I believe this needs to be something other than 0 upon a failed cURL submission?

lukef
User
Posts: 7
Joined: Wed Dec 01, 2010 12:03 am

Re: Getting Error Back from AttachFile.cfm

Post by lukef » Thu Jan 27, 2011 3:08 am

So.

If the attach file action is successful via cURL with ReturnTransfer set to TRUE, I am getting the CF error above as the response, no error message and an error # of 0.

If the attach file action is unsuccessful in that scenario because I use an incorrect api key, the error message is returned in the response, no error message and an error # of 0.

a) Is this the intended behaviour? How do I wrap the cURL response with error handling in this case? I can test the response string for whether it begins with the five letters 'Error' - but even then it's only correct after running trim() and strip_tags() and also relies on Bullhorn not supplying a successful response starting with Error and supplying all errors with response starting with Error. Hardly good coding.

b) If it's not intended behaviour, I've got no problem at all with the suggestion that the problem is in my code - but can you please assist me in finding it please?

Cheers

apsmith
Site Admin
Posts: 2051
Joined: Wed Dec 31, 1969 8:00 pm

Re: Getting Error Back from AttachFile.cfm

Post by apsmith » Fri Jan 28, 2011 9:48 am

lukef,

In the two scenarios that you are mentioning, is the file uploaded correctly in either case, is the error just a downstream effect?
Andrew Smith
Director, Technical Operations
Developer Forum Admin

lukef
User
Posts: 7
Joined: Wed Dec 01, 2010 12:03 am

Re: Getting Error Back from AttachFile.cfm

Post by lukef » Mon Feb 07, 2011 1:23 am

Hey apsmith

The upload is successful in the first scenario and not the second. Which is where my issue lies - if the file uploads correctly but produces the CF error I don't really mind - it's that I'm finding it difficult to wrap error handling around the upload because I get the same error code/message back whether the upload is a success or not and similarly there is always copy in the response regardless of outcome. Testing that the string in the response begins with 'Error' isn't really a safe or long term solution for me.

Cheers
lukef

apsmith
Site Admin
Posts: 2051
Joined: Wed Dec 31, 1969 8:00 pm

Re: Getting Error Back from AttachFile.cfm

Post by apsmith » Mon Feb 07, 2011 1:42 pm

lukef,

Can you find any differences on the files when you are successful vs when you are not? Types of files? Size?
Andrew Smith
Director, Technical Operations
Developer Forum Admin

lukef
User
Posts: 7
Joined: Wed Dec 01, 2010 12:03 am

Re: Getting Error Back from AttachFile.cfm

Post by lukef » Thu Feb 10, 2011 12:32 am

As I've mentioned above, if I attempt to upload a file, let's call it file X, it works but I get the CF error back in the cURL response. If I attempt to upload the same file X but submit an incorrect api key in the cURL post data, I get the Error message coming back in the cURL response also (but an empty error message and an error code of 0 indicating success).

Which, as I've described, doesn't really give me any way to implement error handling reliably on this end.

This scenario appears to happen for me with all the files I've tried. From memory these were pdf and doc files. Between 2MB and 6MB.

apsmith
Site Admin
Posts: 2051
Joined: Wed Dec 31, 1969 8:00 pm

Re: Getting Error Back from AttachFile.cfm

Post by apsmith » Fri Feb 11, 2011 9:59 am

lukef,

I do apologize for this issue, it is a known one with this page. Development has this as a logged bug to be fixed when this API is ported over to the webservice APIs.
Andrew Smith
Director, Technical Operations
Developer Forum Admin

Locked