how to adding data to customObjects

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

Moderators: StaffingSupport, s.emmons, BullhornSupport

Post Reply
mdeg79
User
Posts: 1
Joined: Thu Sep 12, 2019 4:28 am

how to adding data to customObjects

Post by mdeg79 » Thu Sep 12, 2019 7:08 am

Hi there,

We trying what seems like something easy. What we do works to a certain part.

We put data from array to the request url, with this code.
All the variables are placed right in bullhorn. Until the customObject2s.
Nothing happens. Can you tell us what we do wrong?

Code: Select all

$inputdata = array(
            "gender" => "M",
            "firstName" => "Tim",
            "lastName" => "Test",
            "name" => "Tim Test",
            "email" => "tim@zxcv.nl",
            "mobile" => "111111111",
            "source" => "Binnenlands bestuur",
            "dateOfBirth" => date('m/d/Y', strtotime("31/07/2000")),
            "customDate1" => date('m/d/Y'),
            'status' => 'Ingeschreven', 
            'customObject2s' => [
                        'date1' => date('m/d/Y'),
                        'date2' => date('m/d/Y'),
                        'text1' => 'Werving',
                        'text2' => 'Toestemming',
                        'text3' => 'SMS',
                        'textBlock1' => 'notice test'
            ]
                  );
                 
            $cleanPostDatda = json_encode($inputdata);
            $session = isset($session) ? $session : getAuth();
            $url = "{$session['restUrl']}/entity/Candidate?BhRestToken={$session['BhRestToken']}";
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, $url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
            curl_setopt($ch, CURLOPT_POSTFIELDS, $cleanPostDatda);
            $contents = curl_exec($ch);
            $response = json_decode($contents);
            $err = curl_error($ch);
            curl_close($ch);

            // $newCadidateRes = addCandidate($inputdata);
            echo "<pre>";
            print_r($response);  
Part that not work:

Code: Select all

            'customObject2s' => [
                        'date1' => date('m/d/Y'),
                        'date2' => date('m/d/Y'),
                        'text1' => 'Werving',
                        'text2' => 'Toestemming',
                        'text3' => 'SMS',
                        'textBlock1' => 'notice test'
            ]
We also tried this, without success:

Code: Select all

            'customObject2s' => array(
                        'date1' => date('m/d/Y'),
                        'date2' => date('m/d/Y'),
                        'text1' => 'Werving',
                        'text2' => 'Toestemming',
                        'text3' => 'SMS',
                        'textBlock1' => 'notice test'
           )
                  );
Hope anyone can help us.

mholmemi
User
Posts: 24
Joined: Fri Feb 15, 2019 10:31 am

Re: how to adding data to customObjects

Post by mholmemi » Mon Sep 16, 2019 10:28 am

Hi mdeg79,

This is Mikaela with Bullhorn Support. Below is an article with helpful information about using REST with custom objects.

http://bullhorn.github.io/Custom-Objects/

Please let me know if this helps, or if you have any additional questions or concerns.

Best,
Mikaela
Mikaela Holme-Miller | Tier II/Enterprise Support Analyst

Post Reply