Creating a Lead (PHP / Guzzle)

I am attempting to create a new lead using the API with Guzzle for PHP. I am able to pull a list of my leads via the API but when I attempt to create one, I am getting 'Client error: `POST` resulted in a `404 Not Found` response'. I am assuming that the contents of the post (Body) is not correct but I am using an array with the key of 'fieldValues' and the value of an json encoded array of values from the api example.

Is the key of the body fieldValues?

here is a sample of my code:

$lead = [
'FIRST_NAME' => 'Steve',
'LAST_NAME' => 'Smith',
'TITLE' => 'Potential Customer',
'OWNER_USER_ID' => 12345678,
'LEAD_SOURCE_ID' => 234567,
'LEAD_STATUS_ID' => 456789,
'ADDRESS_STATE' => 'Michigan',
'ADDRESS_POSTCODE' => '48312',
'LEAD_DESCRIPTION' => 'website',
$results = $this->client->request('POST',
['fieldValues' => json_encode($lead)],[
'headers' => [
'Authorization' => 'Basic '.base64_encode('my cool
api key)

Anything glaring that I am doing wrong? Thanks!


  • Official comment



    I went ahead and created a ticket so that I conduct some testing for you. Please be on the lookout for any emails.



    Comment actions Permalink
  • Thank you! Is LEAD_ID required, as indicated in the API Body Schema, and should it be 0?

    Comment actions Permalink

Please sign in to leave a comment.