How to transfer files from one candidate to another

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

Moderators: StaffingSupport, s.emmons, BullhornSupport

Post Reply
pawel12123
User
Posts: 5
Joined: Tue Jul 02, 2019 4:15 pm

How to transfer files from one candidate to another

Post by pawel12123 » Thu Jul 25, 2019 11:53 am

Hi all,

I'm trying to recreate the merge feature for mass merging and need to find a way to take the attached files in one candidate, and transfer them to another candidate. I'm using Python and have tried this so far:

Code: Select all

def mergeFiles(base_url, rest_token, candTO, candFROM):
    url = base_url + 'entity/Candidate/{}/fileAttachments?BhRestToken={}&fields=*'.format(candFROM, rest_token)
    print(url)
    response = requests.get(url).json()
    #printCand(response.json())

    test = requests.post(url, data = json.dumps({'name' : 'ChangedName.txt'}))
    print(test)    


However, I get a response[400] message. This syntax worked for merging Work History, so I'm wondering whether this isn't the way I want to merge file attachments, whether file attachment transferring isn't supported by the API or I'm just not seeing an error in the code. Thanks

pawel12123
User
Posts: 5
Joined: Tue Jul 02, 2019 4:15 pm

Re: How to transfer files from one candidate to another

Post by pawel12123 » Thu Jul 25, 2019 11:56 am

FYI, the information inside the json.dumps() was just a test.

I've also tried

Code: Select all

response = requests.get(url).json()
test = requests.post(url, data = json.dumps(response))
and

Code: Select all

test = requests.post(url, data = json.dumps({'candidate' : {'id' : candTO}}))

Post Reply