Hi,
Please find attached copy for the issue I am facing, I want to set data for “person tab” in the deal, which contains “name”, “email”, “phone” I want to add these details via API
Please help me to create a proper array, so that I will pass it through curl’s in php.
I think you need to create the person first, using the endpoint:
https://developers.pipedrive.com/docs/api/v1/#!/Persons/post_persons
and then use the ID in that field when creating the deal.
I’m actually surprised you got a person with the name “Array”.
dani
May 7, 2019, 7:50am
3
@Troels_Gorm_Rasmussen is correct. You first need to create the Person with the endpoint linked above, then pass the id
as person_id
when creating the deal
1 Like
Hello, can you help me?
$data_deal = array('person_id' => array('value' => 25533));
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.pipedrive.com/v1/deals?api_token=xxxxxxx');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_deal);
Where this error?
Thanks in advance!
David
May 7, 2020, 11:01am
6
Hi Jean,
Could you perhaps explain yourself a bit more? What exactly are you trying to achieve and what error are you referring to?
1 Like
what I’m trying to do is assign a person to a deal using the ID of the person. very similar to the other person’s question from this same thread
Thanks David.
David
May 8, 2020, 7:16am
8
Thanks for explaining more, but you mention an error in your original post. Could you tell me what error you’re encountering?
No, just dont work. No change nothing in pipedrive.
hi dani , can you help me?
dani
May 11, 2020, 7:10am
12
hi @cyberpolito
person_id
should be an integer, not an array.
Please, try changing
$data_deal = array('person_id' => array('value' => 25533));
to
$data_deal = array('person_id' => 25533);
1 Like
Thanks dani, but i cant do work!. do you have what is the problem?
$url = 'https://api.pipedrive.com/v1/deals/'.$IDPipe.'?api_token=xxxxxxx';
$data_deal = array('person_id' => 25533);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_deal);
$output = curl_exec($ch);
curl_close($ch);
dani
May 13, 2020, 12:00pm
14
If you’re updating an existing deal you probably need to set
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
Do you get any specific error?
With
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
the error is : “Content-Type: not supported”
dani
May 15, 2020, 2:31pm
16
Why don’t you use one of the PHP library available to handle all these things for you?
There’s an official library , and a community library . Pick one and it will save you a lot of time down the road
which one do you recommend