LEADS API title or person_id field errors

Hi there,

if i use the post lead function via:

https://developers.pipedrive.com/docs/api/v1/#!/Leads/post_leads

the result is:

"error_info": "child \"person_id\" fails because [\"person_id\" must be a number]"

but i entered a number (8275). what am i doing wrong??

if i try it with my API code it fails with the following message:

2020-07-22 18:06:30 debug: Request Data : Array
(
[title] => Anfrage Kontaktformular 2020-07-22 18:06:30
[note] => Mein Anliegen
[person_id] => 8279
[organization_id] => 2829
)


2020-07-22 18:06:30 info: Response Status : 400

2020-07-22 18:06:30 error: Got Http response code 400 when accessing https://XXXXXXX.pipedrive.com/v1/leads?api_token=YYYYYYYYYYY. {“success”:false,“data”:null,“additional_data”:null,“error”:“provided dataset is not valid”,“error_info”:“child “title” fails because [“title” is required]”}

but i submitted a title…

with nearly the same code i can create a person and an organisation. changing the endpoint to lead and the data fields is enough to make it stop working

Hey,

Regarding the first issue ([\"person_id\" must be a number]), this should be fixed now, just a hard refresh is required in your browser in order to fetch the new version of the API documentation without cache.

I will now look closed into the second issue.

Jakub

2 Likes

hey jakub,

i tried again today and the error code changed to:

2020-07-28 13:22:46 error: Got Http response code 400 when accessing https://XXXXX.pipedrive.com/v1/leads?api_token=YYYYYYYYY. {“success”:false,“data”:null,“additional_data”:null,“error”:“expected request body to be sent with application/json content-type”,“error_info”:“Please check developers.pipedrive.com for more information about Pipedrive API.”}

however all other requests work and they do work WITHOUT setting a content-type (multipart/form-data is used in all other requests). this seems to be fairly inconsistent especially since your docs also use form-data encoding: