In the api documentation of the update person endpoint ( https://developers.pipedrive.com/docs/api/v1/#!/Persons/put_persons_id ) it is noted that it’s possible to update one or more phone numbers by pasting them in the same format as outputted by the get method. I tried several approaches like:
which ends in the fact that the first phone number is set to “primary” and the second one remains completely untouched. Has anyone an Idea where this comes from?
I can’t for the life of me get this to work in PHP. I’ve tried creating arrays exactly as shown above, but the entire array ends out getting stuffed into the phone’s “value” field. Does anyone have working code they can share?
Thanks for the quick reply. I’m doing something a drop more complicated - creating a new contact via the “persons” POST command. But I’m sending the identical array and it’s still just not working.
Here are a few lines from the code I’m using (simplified):
And within Pipedrive everything else goes in fine, but the phone field just has the value “Array” in it and nothing more - as if it saw an array and had no idea what to do with it and so called it an “array” and quit.
I guess if I’m desperate, I could create the person in one step and then add his phones in a separate step, via the code you sent (assuming it works). But I’m sure there’s supposed to be a way to do this in one step, but it just ain’t working for me.
Hi,
I’m having a similar problem. I can’t make this work to send the phone number as mobile. I’ve tried several ways, but none seems to work. self.data['phone'] = [{"label": "mobile","value": dados['tel'],"primary": True}]
This way, the phone field is somehow setted as ‘label’, which is bizarre.
Please, note that I already have a dict in my class and it is what I send to the API. If try this, works, but Pipedrive consider this as the work phone for my contact: self.data['phone'] = 123456
How can I set what kindo of phone I’m sending via API?
Of course, I’ve tried @cklos way, but it did not work for me. What am I missing, guys?
I think this should be seen with the rest of the code
Can you send a more comprehensive snippet with the preparation and sending of the request?
You can only leave things related to the phone field.
Of course! So, just to clarify, what I do now is this: self.data['phone'] = dados['tel'] Where dados['tel'] is a number, like 123456… And self.data is a dict() with others informations about the person I’m trying to add.
It works, but Pipedrive consider this phone number as work phone number of the client. What I want to do is set it as mobile, instead of work.
So, I tried to work self.data['phone'] as array and as dict, like I mentioned before. It did not work and had a weird behavior. Pipedrive created the person with phone number as “label” and I have no idea why.
Basically, it turns this self.data['phone'] = [{"label": "mobile","value": dados['tel'],"primary": True}]
into this "phone":[{"label":"","value":"label","primary":true}]
Also, I have other process that updates a person if it has already been created. Maybe the only way to do what I want is through PUT method and not POST method, therefore it’s only possible to do when updating? Thats the only difference between what I’m doing and what @cklos did, I guess.
Hi, I made it work!
What was key here was the header, which I did not configure before, and I had to convert my dict into a json when I’m sending it. So, turns out this was indeed the right to send it.