Parse file attachement

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
nicu.danila
User
Posts: 14
Joined: Tue Oct 05, 2010 12:57 pm

Parse file attachement

Post by nicu.danila » Fri Oct 22, 2010 8:55 am

Hi,

I upload a CV to a Candidate using the AttachFile.cfm API. This API allow me to specify the User ID and the file to upload. The upload works, but the CV is not parsed, so there is no resume preview.
Is there a way I can specify that the uploaded file should be parsed?
I know there is another API (ParseResume.cfm) that would do just that, but that API doesn't let me specify the User ID (so I'm a little unclear of what happens to the parsed details...).

Thanks in advance for your answer,
Nicu

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

Re: Parse file attachement

Post by apsmith » Tue Nov 02, 2010 12:47 pm

Nicu,

To manage this process, you will need to use the API together. The parse resume API will merely parse file and return structured data. As the developer, you would then submit this data into the system using hte update Profile API.
Andrew Smith
Director, Technical Operations
Developer Forum Admin

nicu.danila
User
Posts: 14
Joined: Tue Oct 05, 2010 12:57 pm

Re: Parse file attachement

Post by nicu.danila » Tue Nov 02, 2010 12:57 pm

Thanks, I will try that.

nicu.danila
User
Posts: 14
Joined: Tue Oct 05, 2010 12:57 pm

Re: Parse file attachement

Post by nicu.danila » Fri Nov 05, 2010 5:20 pm

Hi apsmith,

I tried your solution, to upload the CV to the ParseResume.cfm and then to update the user using UpdateProfileAPI.cfm.

The ParseResume.cfm returned this for a sample cv:

Code: Select all

<BHUSERCONTACT><FIRSTNAME>Hj</FIRSTNAME><PHONE>0459-37788</PHONE><HOURLYRATE>0</HOURLYRATE><STATE></STATE>[.......]</BHUSERCONTACT>
I've built an xml based on the example posted on http://www.bullhornstaffing.com/bullhor ... PITest.cfm :

Code: Select all

<root>
    <BHCandidate>
        <USERID>[...]</USERID>
        <FIRSTNAME>Hj</FIRSTNAME><PHONE>0459-37788</PHONE><HOURLYRATE>0</HOURLYRATE><STATE></STATE>[.......]
    </BHCandidate>
</root>
... and submitted it to UpdateProfileAPI.cfm

While this is usefull, because some fields (like the phone number) are populated, this isn't exactly what I am trying to achieve. What I need is to update the "preview" field, so that the content of the CV may be viewed in the candidate list page by clicking on the binoculars, or in the candidate detail page->overview->resume.

Could you please tell me if there's anything wrong with the logic described above, and / or how can I get the preview field to be populated based on the uploaded file?

Thanks,
Nicu

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

Re: Parse file attachement

Post by apsmith » Sun Nov 07, 2010 7:01 pm

Nicu,

Your logic is good, the last addition you would need would be to populate the "description" field on the candidate with the resume body. This will allow the preview to pull the resume body.
Andrew Smith
Director, Technical Operations
Developer Forum Admin

jitender
User
Posts: 18
Joined: Tue Mar 01, 2011 3:48 am

Re: Parse file attachement

Post by jitender » Fri Mar 04, 2011 11:03 am

Hi Nicu,

Can you provide me code to implement parseresume api?

Thanks,
Jitender

nicu.danila
User
Posts: 14
Joined: Tue Oct 05, 2010 12:57 pm

Re: Parse file attachement

Post by nicu.danila » Thu Aug 04, 2011 7:10 pm

@jitender: sorry, I've been off with this issue, I assume you don't need it anymore. However, if you still do, please tell me and I'll post the code I use.

@apsmith: I have yet another question: just when I thought I'm gonna be finished with this, I ran into another issue:
I'm now trying to update the description field with an encoded html but I receive the following error:
Error: xmlData could not be parsed
... which is obvious in a way.... But I just can't figure out what exactly is invalid in the content I send.

I tried to compare what I send:

Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> 	<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=iso-8859-1"> 	<TITLE>...
...with the description received by requesting through GetProfileAPI.cfm the profile of another user that already has that field populated:

Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">    <title>Gregory A</title>    <meta name="Author" content="...
So I notice differences in html code (different doctype, missing tags in the existing description, like <html> or <head>).
But nothing really relevant, I don't think those really make a difference.

I first use unoconv to generate the html and then php/htmlentities to encode it, so everything should be valid. But still I'm missing something..
Can you please tell me if there's any special requirement for the description field. Like for instance only ASCII chars are accepted (just thought of that right now, haven't tested it yet :) )?

Thanks,
Nicu

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

Re: Parse file attachement

Post by apsmith » Mon Aug 08, 2011 3:51 pm

Nicu,

It looks like the XML blob of the resume is not eclosed correctly, have you tried using a CDATA tag? This will help with embedded HTML.
Andrew Smith
Director, Technical Operations
Developer Forum Admin

nicu.danila
User
Posts: 14
Joined: Tue Oct 05, 2010 12:57 pm

Re: Parse file attachement

Post by nicu.danila » Mon Aug 08, 2011 3:54 pm

Ahh, CDATA, I've forgotten about that...
Thanks apsmith, I'll try that and I'll come back with the results :)

nicu.danila
User
Posts: 14
Joined: Tue Oct 05, 2010 12:57 pm

Re: Parse file attachement

Post by nicu.danila » Wed Aug 10, 2011 4:32 am

Finally found the issue. I was replacing the html entities for the description field, and actually that fields was ok (event without a CDATA wrapper). However, the xml I was sending was initially built based on the items found in the xml received by making a call to ParseResume.cfm. That xml doens't have the fields escaped. So basically the issue was that the API returns some xml data but it won't accept it back :)

jitender
User
Posts: 18
Joined: Tue Mar 01, 2011 3:48 am

Re: Parse file attachement

Post by jitender » Mon Nov 07, 2011 8:49 am

Hi Nicu,

Can you please send me your code now. What I implemented last has stopped working. Files are not getting attached. I posted to support also but no reply. You can check at http://supportforums.bullhorn.com/viewt ... 32&t=12071.

Thanks,
Jitender

nicu.danila
User
Posts: 14
Joined: Tue Oct 05, 2010 12:57 pm

Re: Parse file attachement

Post by nicu.danila » Wed Nov 09, 2011 10:00 am

jitender wrote:Hi Nicu,

Can you please send me your code now. What I implemented last has stopped working. Files are not getting attached. I posted to support also but no reply. You can check at http://supportforums.bullhorn.com/viewt ... 32&t=12071.

Thanks,
Jitender
Hi Jitender,

I took a look over your code. The thing is that I use PHP and send the file by CURL, so I don't think my code will help you:

Code: Select all

  $c = curl_init('https://cls5.bullhornstaffing.com/BullhornStaffing/API/AttachFile.cfm');
  curl_setopt($c, CURLOPT_POST, 1);
  curl_setopt($c, CURLOPT_POSTFIELDS, array(
    ...
    'resumeFile' => "@$fileName",
  ));
  curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
  $content = curl_exec($c);
  curl_close($c);
Where $fileName is the variable containing the filename, on disk. The '@' tells CURL that it should treat that value as a file upload. That's it, I don't set any headers (although I could add any if I would like to).
PHP rocks :)
Nicu

Locked