API Proxy end point cannot add multi dimensional Email and Phone

@dani could you help me here :smiley: thanks

hi @atayyaa,
I suspect there’s something wrong with how the data you’re trying to send is prepared.

Can you do a print_r of the data you’re trying to send?

@dani this is the reponse

{“success”:true,“data”:{“id”:579,“company_id”:6325748,“owner_id”:{“id”:9512217,“name”:“adriene amigable",“email”:"setanta.user101@takingyouforward.org”,“has_pic”:false,“pic_hash”:null,“active_flag”:true,“value”:9512217},“org_id”:{“name”:“HIVE-APPSTONE”,“people_count”:7,“owner_id”:9512217,“address”:null,“active_flag”:true,“cc_email”:“forwardbpo-sandbox-1f93ae@pipedrivemail.com”,“value”:349},“name”:“test dani”,“first_name”:“test”,“last_name”:“dani”,“open_deals_count”:0,“related_open_deals_count”:0,“closed_deals_count”:0,“related_closed_deals_count”:0,“participant_open_deals_count”:0,“participant_closed_deals_count”:0,“email_messages_count”:0,“activities_count”:0,“done_activities_count”:0,“undone_activities_count”:0,“reference_activities_count”:0,“files_count”:0,“notes_count”:0,“followers_count”:0,“won_deals_count”:0,“related_won_deals_count”:0,“lost_deals_count”:0,“related_lost_deals_count”:0,“active_flag”:true,“phone”:[{“value”:"",“primary”:true}],“email”:[{“value”:"",“primary”:true}],“first_char”:“t”,“update_time”:“2019-09-04 07:55:47”,“add_time”:“2019-09-04 07:55:47",“visible_to”:“3”,“picture_id”:null,“next_activity_date”:null,“next_activity_time”:null,“next_activity_id”:null,“last_activity_id”:null,“last_activity_date”:null,“last_incoming_mail_time”:null,“last_outgoing_mail_time”:null,“label”:1,“org_name”:“HIVE-APPSTONE”,“cc_email”:"forwardbpo-sandbox-1f93ae@pipedrivemail.com”,“owner_name”:“adriene amigable”},“related_objects”:{“organization”:{“349”:{“id”:349,“name”:“HIVE-APPSTONE”,“people_count”:7,“owner_id”:9512217,“address”:null,“active_flag”:true,“cc_email”:“forwardbpo-sandbox-1f93ae@pipedrivemail.com”}},“user”:{“9512217”:{“id”:9512217,“name”:“adriene amigable",“email”:"setanta.user101@takingyouforward.org”,“has_pic”:false,“pic_hash”:null,“active_flag”:true}}}}

that is the reponse from the php prin_r()

phone html form

email html form

im just testing only 1 data that why i put 0 on the array

sorry for the delay reply because i just work with the other functions
Please let me know how to fix this

@dani @David
[name] => test8
[label] => Customer
[email] => Array
[0] => Array
[value] => test8@gmail.com
[label] => work


[phone] => Array
        [0] => Array
                [value] => 12345678
                [label] => work


[e531103cf7ce5f6464ebd80a446296f488293f3d] => 61
[visible_to] => 3
[org_id] => 349
[owner_id] => 9512217


@dani could you help me here :smiley: thanks

Hi @atayyaa,
Sorry to hear you’re still having issues with this.

It’s very hard to debug with snippets of screenshots of code without knowing what you’re trying to achieve and what the error messages really are.
So let’s try to break it down and see where the problem is.

You’ll have to help me help you :smiley:

First of all, we need to figure out if the requests you’re trying to make are actually valid.
So, if we leave your code aside for a minute, can you try to make all the requests you’re trying to make in your code using something like Postman?

That would mean

  • getting the access_token
  • using the access_token to post a new person with the exact data that you want


  • If it doesn’t work, please post the error message that you get.
  • If it works, then please post the full code (no screenshot) of the point in which you receive the error.

We’ll figure it out :v:

If you haven’t used Postman before, the video on this page will help you.

was this using Postman?

yes this is from postman

can you make a GitHub repo or gist with the full code?


@dani can you help me with this?
@David Can you help me with this gist.github.com/adrienecarreamigable01/d14481e9e25eb03915b9b0f31104bab4

It looks like the code you posted is still not the full code…

I sense some confusion here :smiley: @atayyaa, and while it’s still hard for me to tell you exactly what you’re doing wrong, I can try to give you a few hints about what I can see so far and hopefully some of these points make sense to you and help you figure out what to do next…

  • The api token, should not be used like that inside a js file, because it means that anyone can read it. From javascript you should contact your own server, and from the server you can then make an API call to Pipedrive authenticated with API token or OAuth.
  • Even if you decide for some reason to use the API token inside your js code (bad idea, but maybe it’s a private project), I can see that inside person.js you first use the variable apiToken like this
    "api_token": apiToken,
    which can be “ok” if the variable contains the api token, but then you use the same variable like this
    url: base_url() + 'persons/addPerson/' + apiToken,
    which is not correct. It should maybe be 'persons/?api_token=' + apiToken.
  • Also, 'persons/addPerson/' is not a valid endpoint. Maybe what you’re trying to do is to make a POST request to persons like shown here https://developers.pipedrive.com/docs/api/v1/#!/Persons/post_persons
  • I don’t see any implementation of OAuth in the code you posted last.

It looks like your project needs more attention than I can offer at this point. May I suggest you to try asking for help in Hire a Developer? Maybe there you can find someone who can take a deep look at everything and help you out.

Hope it helps :peace_symbol: :v:

I think we have miss understanding here…
I’m using an oauth i cant use this 'persons/?api_token=' + apiToken
I only use the API token as an authorization Bearer.
Sorry i didnot send the PHP CODE

Please review again

Can you try to add a new peron by your own?? using oauth?? using multi dimentional array input? not using the https://api.pipedrive.com/v1/persons?api_token=

use the https://api-proxy.pipedrive.com/ for oauth

Did you take a look at previous posts? This might help you Update the phone numbers of a person

yes but im not using the v1 im using the api proxy and the data it send is not thesame :frowning:

Can you try is on the post man if you have time i can wait i just use no multidimensional but no work or home data …

This is now ok thanks

1 Like