Non-Agent API update_lead "INVALID DATA FOR LEAD INSERTION"

All installation and configuration problems and questions

Moderators: gerski, enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, Michael_N

Non-Agent API update_lead "INVALID DATA FOR LEAD INSERTION"

Postby nsbaEric » Mon Apr 06, 2020 12:00 pm

Hey guys, I have a script I wrote that's importing leads into our VICIdial system, and I'm getting the error above, and I can't quite figure out why.

VERSION: 2.14-673a
BUILD: 180512-2217
(old, I know)

Here's an example of the call I'm using:
Code: Select all
http://<ip>/vicidial/non_agent_api.php?source=mailerrecycler&user=<user>&pass=<pass>&function=update_lead&insert_if_not_found=Y&search_method=VENDOR_LEAD_CODE_PHONE_NUMBER&search_location=LIST&records=1&vendor_lead_code=<vendor_lead_code>&phone_number=<phone_number>&first_name=<first_name>&last_name=<last_name>&address1=<address1>&city=<city>&state=<state>&postal_code=<postal_code>&security_phrase=<security_phrase>&list=<list>&title=<title>&phone_code=1&status=NEW


If you want an example with actual dummy data to see how I'm formatting things:
Code: Select all
http://127.0.0.1/vicidial/non_agent_api.php?source=pythonscript&user=1234&pass=password&function=update_lead&insert_if_not_found=Y&search_method=VENDOR_LEAD_CODE_PHONE_NUMBER&search_location=LIST&records=1&vendor_lead_code=18675309&phone_number=1234567890&first_name=John&last_name=Doe&address1=1234+56th+St+Apt+9Z&city=Utopia+City&state=CA&postal_code=12345&security_phrase=Bert+Borta&list=1234&title=XYZ&phone_code=1&status=NEW


And the response I'm getting (with the dummy data above):
Response code: <Response [200]>
['NOTICE: update_lead NO MATCHES FOUND IN THE SYSTEM: ', '1234', '', '18675309', '1234567890\nERROR: update_lead INVALID DATA FOR LEAD INSERTION - 1234', '1234567890', '1', '', 'Y\n']


The script is updating existing leads just fine, so I don't really know why it's not liking the data for inserting a new lead. I just don't see what it's not liking, I'm guessing it's the empty column after the '1' in the response, but I don't know what these columns are supposed to be, and I can't find clear documentation of it anywhere. So if someone can provide me with some insight on what's wrong here, I'd really appreciate it, thank you.
nsbaEric
 
Posts: 2
Joined: Fri Apr 03, 2020 4:37 pm

Re: Non-Agent API update_lead "INVALID DATA FOR LEAD INSERTI

Postby blackbird2306 » Mon Apr 06, 2020 7:42 pm

The "list_id" variable seems to be misspelled (list) in your request.

phone_code (ok)
phone_number (ok)
list_id (wrong)

insert_if_not_found - Y or N, will attempt to insert as a NEW lead if no match is found, default is N.
Insertion will require phone_code, phone_number and list_id. lead_id will be ignored.
Most of the add_lead options that are not available if you use this setting in this function
Vicibox 6.0.2 from Vicibox_v.6.0.x86_64-6.0.2.iso | Vicidial 2.12-560a build: 160617-1427 | Asterisk 1.8.32.3
blackbird2306
 
Posts: 409
Joined: Mon Jun 23, 2014 5:31 pm

Re: Non-Agent API update_lead "INVALID DATA FOR LEAD INSERTI

Postby nsbaEric » Mon Apr 06, 2020 9:15 pm

Of course! I feel so silly for missing that. I just fixed that, and ran it, and it's working perfectly now. Thank you so much for your help.
nsbaEric
 
Posts: 2
Joined: Fri Apr 03, 2020 4:37 pm


Return to Support

Who is online

Users browsing this forum: No registered users and 73 guests