Broken APIs and other time wasters

So I spent the day trying to figure out why my simple form submission which then generated an XML output, and then a subsequent post to Zoho CRM, did not, in fact, work.

I was doing this without the Zoho code, just a description of their API. Its an older API, that much is obvious. You talk to it through XML. You post your XML. But you put parameters on the URI to control the post.

I reduced my problem down to a very simple test script, that perfectly illustrated the problem.

The code is here:


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_zoho_authtoken_here';

my $xml	= < <'EOT';

Web Download


my $url;
$url	= sprintf '',

my $result = $ua->post($url , xmlData => $xml);
printf "result = %s\n ",$result->content;

In every case I tried (and I started with this, and moved on to multipart forms, as well as a number of guesses based upon their API specs), I received an error code of 4600, which suggested something was formatted wrong.

So I reduced the XML down to a single field, firstname, and tried that. No dice.

I finally gave in and sent them a note with the code, asking them how to make it work. Will look later.

I tested the retrieve features to pull in some of our other data to test the authtoken. That worked fine. So I know that works. It appears that their server might simply not like LWP generated requests. Or something like that.

So tomorrow, I’ll hook this into our DB (either MongoDB, or PostgreSQL), and once we get a hand on the data import, I’ll write a quick ETL layer.

Viewed 47431 times by 4664 viewers