Problems with Error message and Docs related to CertificationFileAttachment "missing required property:candidate"

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

Moderators: StaffingSupport, s.emmons, BullhornSupport

Post Reply
dkearney
User
Posts: 1
Joined: Mon Jun 13, 2022 6:05 am

Problems with Error message and Docs related to CertificationFileAttachment "missing required property:candidate"

Post by dkearney »

The docs are unclear and it took a while to figure out our problem.

Error Message:

{'errorMessage': 'error persisting an entity of type: CertificationFileAttachment',
'errorMessageKey': 'errors.cannotPersistEntity',
'errorCode': 500,
'errors': [{'detailMessage': 'missing required property: candidate',
'propertyName': 'candidate',
'severity': 'ERROR',
'type': 'MISSING_REQUIRED_PROPERTY'}],
'entityName': 'CertificationFileAttachment'}

The problem with this error message
This error message complains about a property that is missing, which in fact is the wrong property.
Instead of passing a "candidate" property, or and "id" property, you must pass "canditateID" with the bullhorn candidate id as an integer.

So you would pass the following json in your request:

Code: Select all

import requests
bullhorn = initialize_bullhorn()
token = bullhorn.client.get_params()["BhRestToken"]
url = "https://your_rest_api_url/path/to/file/CertificationFileAttachment"
params = {'BhRestToken': token}

json = {'candidateID': candidate_id,                         # This is required but the error message instructs you to add something different.
        'fileContent': "FILE_STRING_HERE", 
        'fileType': '.jpeg', 
        'name': 'TEST.jpeg', 
        'contentType': 'image/jpeg', 
        'type': 'my_type'}

result = requests.put(url, params=params, json=json)

Please update the error message and documentation to describe this behaviour. Thanks!
Post Reply