Hi folks:
I read through the API examples for insertRecords. I am attempting to insert a record into the Leads. I followed the examples, and yet no matter which variant I tried, I always received an error:
<response><error><code>4600</code><message>Unable to process your request. Please verify if the name and value is appropriate for the "xmlData" parameter.</message></error></response>
The code I wrote is very simple:
#!/usr/bin/perl
use v5.14;
use strict;
use warnings FATAL => 'all';
use LWP::UserAgent;
use Data::Dumper;
my $ua
= LWP::UserAgent->new(ssl_opts => { verify_hostname => 0 });
my $zoho_auth_token
= 'Insert_Your_API_Key_Here'; # replace with your API key
my $xml
= <<'EOT';
<Leads>
<row no="1">
<FL val="Lead Source">Web Download</FL>
<FL val="Company">scalable</FL>
<FL val="First Name">test1</FL>
<FL val="Last Name">test1</FL>
<FL val="Title">test2</FL>
<FL val="Phone">1234567890</FL>
</row>
</Leads>
EOT
my $url;
$url
= sprintf 'https://crm.zoho.com/crm/private/xml/Leads/insertRecords?authtoken=%s&scope=crmapi&newFormat=1&duplicateCheck=1',
$zoho_auth_token;
my $result = $ua->post($url , xmlData => $xml);
printf "result = %s\n ",$result->content;
I have tried altering the URL to include xmlData=... directly on it. I've tried creating multipart form submission. I've used numerous alternative mechanisms of constructing the call. But no matter what I do, I always get the 4600 error message.
So I tried my authtoken with a hand written browser based request url:
and I get back correct xml with the right data in it. So I know that the authtoken works.
Are there simple examples (exactly like the above) that can demonstrate the insertion?
Is there a JSON interface we could use instead for this?