frodwith / amazon-mws Goto Github PK
View Code? Open in Web Editor NEWPerl API bindings to Amazon Marketplace Web Services
Perl API bindings to Amazon Marketplace Web Services
Hi,
This module looks promising - but is it still supported/ meant to work? Cos I can't get it to :(
# Initiate FBA fulfillment report generation
use lib '/var/home/steveraf/perl5/lib/perl5';
use strict;
use Amazon::MWS::Enumeration::ReportType qw(:all);
use Amazon::MWS::Client;
use DateTime;
my $mws = Amazon::MWS::Client->new(access_key_id=>"xxx",
secret_key => "xxx",
merchant_id => "xxx",
marketplace_id => "xxxx",
endpoint => "https://mws.amazonservices.co.uk/");
my $req;
eval {
$req = $mws->RequestReport(ReportType => (_GET_AMAZON_FULFILLED_SHIPMENTS_DATA_),
StartDate => DateTime->now->add(weeks => -5),
EndDate => DateTime->now);
};
print qq|StartDate =>|. DateTime->now->add(weeks => -5) . qq|,
| . EndDate => DateTime->now;
if(my $e = Exception::Class->caught('Amazon::MWS::Client::Exception')) {
die $e->error . "\n" . $e->trace->as_string . "\n";
}
elsif($@) {
die $@;
}
if (my $req_id = $req->{ReportRequestInfo}->[0]->{ReportRequestId}) {
open my $req, "> request.${req_id}";
close $req;
}
When I run it from SSH, all I get is an empty request.51473016616 file (even though I know I have tons of FBA sales to look at)
When I do a SubmitFeed() call with a FeedType of 'POST_ORDER_FULFILLMENT_DATA' (and a XML request document), I do not get a parsed result back (the response is just empty). Amazon sends a valid response XML document though. Doing some debugging, I found out that the problem seems to be in the line
return $spec->{respond}->($root);
in the method define_api_method(). Maybe you have an idea what could be wrong? An example Amazon MWS response can be found here:
With the newest version of the Amazon::MWS::Client class, I get an error message when calling SubmitFeed() with an XML message that goes into the HTTP body:
Use of uninitialized value in subroutine entry at Amazon/MWS/TypeMap.pm line 42.
I found out, that the cause is a call to the method to_amazon() in TypeMap.pm (this method is in line 42), which is being called with a type of 'HTTP-Body' which is not known in the mapping %to_map (the value is the request XML document).
By adding the type to the mapping, it seems to be resolved. The below patch should fix the problem. Would be great if you could have a look at it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.