Not being able to save using Remote API

Not being able to save using Remote API

I'm successfully being able to upload & view a spreadsheet, but when I keep getting 404 errors when Zoho tries to save to my remote server. I tested the multi-part save using an HTML form and it works in that case.

Here's the code for uploading the spreadsheet (with the key & domain being changed for posting purposes):

#!/usr/bin/perl

use CGI::Carp qw ( fatalsToBrowser);
use warnings;
use CGI qw(param header);
use Cwd;

use LWP::UserAgent;
use HTTP::Request::Common;
use WWW::Mechanize;

print header;

my $browser = new LWP::UserAgent;
my $filename = param('file');

my $response = $browser->post(
'http://sheet.zoho.com/remotedoc.im?apikey=dsafhereismykey28c499&output=url',
[ 'saveurl' => 'http://www.hereismydomain.org/cgi-bin/zoho/zohosave.cgi',
'content' => [$filename],
'id' => '12345678',
'format' => 'xls',
],
'Content_Type' => 'form-data',
);


if ($response->is_success) {
$response->content =~ /.*URL=(.*)/;

my $mechanize = WWW::Mechanize->new(autocheck => 1);
$mechanize->get($1);
my $html = $mechanize->content;
print $html;
}
else {
die $response->status_line;
}







































Here's the code for accepting the multipart format:

#!/usr/bin/perl

use CGI::Carp qw ( fatalsToBrowser);
use warnings;
#use CGI qw(param header);
use CGI qw/:cgi/;
use Cwd;

$query = new CGI;

$upload_dir = "../../zohoupload";
$filename = $query->param("filename");
$upload_filehandle = $query->upload("content");

open (UPLOADFILE, ">$upload_dir/$filename");

binmode UPLOADFILE;

while ( <$upload_filehandle> )
{
print UPLOADFILE;
}


close UPLOADFILE;



print $query->header ( );
# print <<END_HTML;
print "<HTML>
<HEAD>
<TITLE>Thanks!</TITLE>
</HEAD>

<BODY>

<P>Thanks for uploading</P>


</BODY>
</HTML>"

# END_HTML



















































      • Sticky Posts

      • Slicers are now available in Zoho Sheet—filter your data interactively

        At Zoho Sheet, we diligently track user requests and feedback. In line with this, based on extensive user requests, we've integrated Slicers to pivot tables and are delighted to announce its release. Slicers are interactive visual filters that have add,
      • Check out the new Checkbox in Zoho Sheet

        Checkbox, the simple GUI widget that lets you choose between two mutually exclusive options i.e Yes or No, is now in Zoho Sheet. Having made it across the web, Checkbox is familiar but is still elusive to most spreadsheet software. Special developer ribbons, macros and all other complexities to add a checkbox to a spreadsheet? Not in Zoho Sheet. How to add Checkbox to Zoho Sheet? Adding a Checkbox in Zoho Sheet is simple. Select a cell/range and choose "Checkbox" in "Input Controls" under the Format
      • Format and analyze spreadsheet data with Zoho Sheet's Table

        While a spreadsheet helps you compile data for easy analysis, formatting helps make your data more comprehensible. We are happy to announce the release of Table, a crucial tool for improving data formatting in Zoho Sheet. More than a formatting tool,
      • Introducing Data Bars: Graphically represent changes in data within the cells

        Conditional formatting has helped millions of spreadsheet users analyze and highlight their data more efficiently. In addition to the classic rules, color scales, and icon sets available in Zoho Sheet, you can now apply Data Bars, a convenient method
      • Zia in Zoho Sheet now makes suggestions on conditional formats, picklists, and checkboxes

        Zia, Zoho's popular AI assistant, has been helping users succeed across Zoho applications since inception. In Zoho Sheet, Zia helps users efficiently build reports and analyze data with recommendations about data cleaning, charts, and pivot table. Also,