hakanensari / peddler Goto Github PK
View Code? Open in Web Editor NEWAmazon MWS API client
License: MIT License
Amazon MWS API client
License: MIT License
client.request_report('_GET_FLAT_FILE_OPEN_LISTINGS_DATA_', marketplace_id_list: ['ATVPDKIKX0DER'])
throws a
Peddler::Marketplace::BadId: missing MarketplaceId
When I set
client.primary_marketplace_id = "ATVPDKIKX0DER"
and run the command again, it throws a
ArgumentError: Missing secret
Instead of hogging memory, it would be neater to just stream large feeds into parser in the Feeds API. Off the top of my head, it feels the external API probably would not have to change. #each would simply return CSV rows or XML nodes as they come in.
Time to simplify this library:
💦
It would be great to parse the MWS responses using a SAX parser instead of waiting for the whole response to load first. Fog has an example implementation.
Spike Ox as well.
Noticing very large backlogs as per last week's troubleshooting. See report dated Saturday for amazon-1-de:
blackbook@gilles:~/app/current$ RAILS_ENV=production bundle exec rake catalog:count
4d4ac0f07ca8794c2900003bCatalog ID:
Listed: 890,905
Added: 158,954
Modified: 1,263,828
Deleted: 107,420
Listing count on open listings report is LOWER than above total.
This might be an issue with peddler, or possibly an issue with giles.
Amazon is returning Content-Type "text", for the listings reports, which are "tab-delimited flat file" format, meaning that calling:
mwsr = MWS::Reports.new
mwsr.get_report(report_id)
# raises `NotImplementedError` in parser.rb
It looks like https://github.com/hakanensari/peddler/blob/master/lib/peddler/parser.rb#L14-21 is intended to handle this?
I keep getting 404 responses when attempting to use the CustomerInformation API.
Do you know if this is indicative of the api access not being enabled on my account yet?
I've setup access to use the CustomerInformation API so I would expect this to work, but think it maybe something wrong on Amazon's end.
Running into a lot of issues where the connection will just fail, and I'll get a
"Excon::Errors::BadRequest: Expected(200) <=> Actual(400 Bad Request)"
I'm working mostly with creating new shipment plans and shipments. After digging for an hour I figured out that one of my skus (out of about 50) didnt have dimensions entered. Any way this error flow can be improved?
Hello, I've looked at the code and the tests, and I couldn't find an answer to this. How to list order by their status, whatever I do seems like it causes Bad Request, here are some examples I tried:
response = @client.list_orders(order_status: ['Unshipped', 'PartiallyShipped'])
response = @client.list_orders(order_status: 'Shipped')
I get the same error:
Excon::Errors::BadRequest: Expected(200) <=> Actual(400 Bad Request)
Am I doing something wrong? Also can I inspect the request itself to see which request is being generated?
Hello! Recently I stumbled upon this function called GetLowestPricedOffersForSKU in Products section of MWS, and it looks like it was recently added to other client libraries, so maybe it's new?
I dug through the documentation for this gem and couldn't find a method for it. Can you please update this gem to support it? I'm trying to figure out how to do it myself, but I've never written a gem before and am having a bit of trouble. Thanks for your consideration!
Running into another bug and I'm wondering if this is the issue:
code looks like this:
def put_transport_content(shipment_id, is_partnered, shipment_type, transport_details)
operation('PutTransportContent')
.add(
'ShipmentId' => shipment_id,
'IsPartnered' => is_partnered,
'ShipmentType' => shipment_type,
'TransportDetails' => transport_details
)
run
end
other similar functions include:
def put_transport_content(shipment_id, is_partnered, shipment_type, transport_details)
operation('PutTransportContent')
.add(opts.update(
'ShipmentId' => shipment_id,
'IsPartnered' => is_partnered,
'ShipmentType' => shipment_type,
'TransportDetails' => transport_details
))
.structure!('PackageList', 'member')
run
end
no idea what the extra code does, but similar functions have it and this seems to be missing it.
been getting another "Excon::Errors::BadRequest: Expected(200) <=> Actual(400 Bad Request)"
and everything from what I can tell everything I enter should work (I even did a get_transport_content and copied the data with no luck). Thoughts?
The API method to retrieve unique package labels is missing. Can you please add?
http://docs.developer.amazonservices.com/en_US/fba_inbound/FBAInbound_GetUniquePackageLabels.html
Thanks!
RubyGems.org doesn't report a license for your gem. This is because it is not specified in the gemspec of your last release.
via e.g.
spec.license = 'MIT'
# or
spec.licenses = ['MIT', 'GPL-2']
Including a license in your gemspec is an easy way for rubygems.org and other tools to check how your gem is licensed. As you can imagine, scanning your repository for a LICENSE file or parsing the README, and then attempting to identify the license or licenses is much more difficult and more error prone. So, even for projects that already specify a license, including a license in your gemspec is a good practice. See, for example, how rubygems.org uses the gemspec to display the rails gem license.
There is even a License Finder gem to help companies/individuals ensure all gems they use meet their licensing needs. This tool depends on license information being available in the gemspec. This is an important enough issue that even Bundler now generates gems with a default 'MIT' license.
I hope you'll consider specifying a license in your gemspec. If not, please just close the issue with a nice message. In either case, I'll follow up. Thanks for your time!
Appendix:
If you need help choosing a license (sorry, I haven't checked your readme or looked for a license file), GitHub has created a license picker tool. Code without a license specified defaults to 'All rights reserved'-- denying others all rights to use of the code.
Here's a list of the license names I've found and their frequencies
p.s. In case you're wondering how I found you and why I made this issue, it's because I'm collecting stats on gems (I was originally looking for download data) and decided to collect license metadata,too, and make issues for gemspecs not specifying a license as a public service :). See the previous link or my blog post about this project for more information.
As a marketplace seller, we want to use Jeff under the hood so we may work with MWS performantly.
The existing library API serves us well:
client = Peddler.new "US"
client.configure do |c|
c.key = 'foo'
c.secret = 'bar'
c.seller = 'baz'
end
As a Marketplace seller, we want to download reports through MWS so we may lay the legacy AIM interface to rest.
Hi there, I can't seem to call get_capture_details to work. I looked into the source code:
def get_capture_details(amazon_capture_id)
operation('GetAuthorizationDetails')
.add('AmazonCaptureId' => amazon_capture_id)
run
end
Should the operation be set to GetCaptureDetails? Thanks!
I've tried passing an array into the ones that allow for multiple products. Doesn't work.
Using the code from the read me on how to access another seller's mws (having been given there mws auth token) we get:
ArgumentError: Missing secret
from the Jeff library. That lib seems to require a secret.
I don't know if this is a bug with the jeff lib, but, as the read me implies this is working I think it is a bug inside here.
Current errors are not expressive:
client.get_feed_submission_result id
# => Excon::Errors::NotFound: Expected(200) <=> Actual(404 Not Found)
If you don't already have a notion of what this means, the workaround is to rescue and peek into response:
begin
client.get_feed_submission_result id
rescue Exception => ex
puts ex.response.parse
# => {"Type"=>"Sender", "Code"=>"FeedProcessingResultNotReady", "Message"=>"Feed Submission Result is not ready for Feed 191837016796", "Detail"=>nil}
end
Instead, we could perhaps throw an error that inherits from Excon::Errors::NotFound
, sets class name to the value of Code
—FeedProcessingResultNotReady
in this case—and set the error message to the value of Message
. Inheriting from the original error should make this largely backwards-compatible, assuming people rescue Excon error types to handle specific cases (throttling, etc.).
Hello again,
I'm currently uploading products to my origin marketplace germany. I'm trying to update amazon products in different countries in europe. I can't use marketplace_id_list, cause I'm making my own translations of my products. Like in your instruction i've changed the value of primary_marketplace_id to the marketplace-ID of the country I want to update in. The result is that no matter which marketplace-ID I'm giving to the client, the submit end up in my origin marketplace germany.
MWS.feeds(
primary_marketplace_id: "", <--- tried ES, FR and UK
merchant_id: XXX,
aws_access_key_id: XXX,
aws_secret_access_key: XXX
)
I thought maybe there is a problem with the MWS-API. So I wrote the MWS-support. They gave me the request that I've sended. It looked like this:
02 Jul 2015 11:36:53,568 [DEBUG] d6477694-5377-4ce1-a75e-46438051023f: request from
AWSAccessKeyId=XXX&
Action=SubmitFeed&
FeedType=_POST_FLAT_FILE_LISTINGS_DATA_&
SellerId=XXX&
Signature=XXX&
SignatureMethod=HmacSHA256&
SignatureVersion=2&
Timestamp=2015-07-02T11%3A36%3A20Z to POST
They told me I have to give a marketplace-ID in my request. Do you have an idea why the marketplace-ID is missing in the request?
For info: I have a europe selleraccount and I'm authorized to sell in the other countries.
Thank you for helping.
best regards stravas
Hi, I'm not sure if I'm doing something incorrectly but I keep on getting the 400 bad request error when using fulfillment.list_inventory_supply()
I'm trying to use the :seller_sku_list argument to get a list of inventory for that SKU but I keep on getting the 400 error
I've tried using a time range and that works fine.
I've tried using an array and just a string value both, the same error still.
I've used this:
fulfillment_inventory.list_inventory_supply({ :seller_sku_list => %w(AB-BC-CD-33) })
and this:
fulfillment_inventory.list_inventory_supply({ :seller_sku_list => "AB-BC-CD-33 })
Using the code below works just fine.
fulfillment_inventory.list_inventory_supply({:query_start_date_time => (some_time).iso8601})
The exact error that I get is:
/home/.rvm/gems/ruby-2.2.0/gems/excon-0.44.1/lib/excon/middlewares/expects.rb:6:in `response_call': Expected(200) <=> Actual(400 Bad Request) (Excon::Errors::BadRequest)
from /home/.rvm/gems/ruby-2.2.0/gems/excon-0.44.1/lib/excon/middlewares/response_parser.rb:8:in `response_call'
from /home/.rvm/gems/ruby-2.2.0/gems/excon-0.44.1/lib/excon/connection.rb:372:in `response'
from /home/.rvm/gems/ruby-2.2.0/gems/excon-0.44.1/lib/excon/connection.rb:236:in `request'
from (eval):3:in `post'
from /home/.rvm/gems/ruby-2.2.0/gems/peddler-0.12.1/lib/peddler/client.rb:91:in `run'
from /home/.rvm/gems/ruby-2.2.0/gems/peddler-0.12.1/lib/mws/fulfillment_inventory/client.rb:27:in `list_inventory_supply'
from get_fullfilment_inventory.rb:58:in `<main>'
Any help is appreciated.
Thanks.
I'm using the following to upload a tab delimited text file
def upload
file = open('http://simplrmarketr.com/products/amazon.txt')
contents = file.read
client = MWS.feeds
result = client.submit_feed(contents, "_POST_PRODUCT_DATA_", {})
puts result.parse
end
However, when I check the results, I get the following error:
<ResultDescription>XML Parsing Fatal Error at Line 1, Column 1: Content is not allowed in prolog. Content is not allowed in prolog.</ResultDescription>
Very interested in making this work any pointers would be greatly appreciated.
Hello!
I tried to use multiple asins for #get_lowest_offer_listings_for_asin. But it didn't work.
@client.get_lowest_offer_listings_for_asin("3492700934, 3551354014")
@client.get_lowest_offer_listings_for_asin(["3492700934", "3551354014"])
A single asin works:
@client.get_lowest_offer_listings_for_asin("3492700934")
I gets the following messages:
Expected(200) <=> Actual(400 Bad Request)
#<Excon::Response:0x00000006066e58
@body=
"<?xml version=\"1.0\"?>\n<ErrorResponse xmlns=\"http://mws.amazonservices.com/schema/Products/2011-10-01\"><Error><Type>Sender</Type><Code>InvalidParameterValue</Code><Message>3492700934, 3551354014 is not a valid ASIN</Message><Detail/></Error><RequestID>8c856b6b-e770-4fee-8448-8b026c84f210</RequestID></ErrorResponse>
``
Can you help me?
Those are :
Cart Information
Customer Information
I think they should be removed at least from README, until it's removed from the code.
The endpoint override in lib/peddler/client.rb needs to be changed to aws_endpoint.
Also, I'm assuming you did a partial commit as the stubs for the new APIs aren't there. I added them in a separate commit in my fork.
I can do a pull request(s) if you like.
from /home/daryl/.rvm/gems/ruby-2.2.2@drewp_tracker/gems/peddler-0.17.0/lib/peddler/client.rb:214:in `decorate_error'
from /home/daryl/.rvm/gems/ruby-2.2.2@drewp_tracker/gems/peddler-0.17.0/lib/peddler/client.rb:208:in `handle_error'
from /home/daryl/.rvm/gems/ruby-2.2.2@drewp_tracker/gems/peddler-0.17.0/lib/peddler/client.rb:177:in `rescue in run'
from /home/daryl/.rvm/gems/ruby-2.2.2@drewp_tracker/gems/peddler-0.17.0/lib/peddler/client.rb:171:in `run'
from /home/daryl/.rvm/gems/ruby-2.2.2@drewp_tracker/gems/peddler-0.17.0/lib/mws/products/client.rb:26:in `list_matching_products'
(Offending line)[https://github.com/hakanensari/peddler/blob/master/lib/peddler/client.rb#L214]
I think you just need a
require 'peddler/error_parser'
in client.rb
, right?
Hi
When I try and call either method for getting categories for Products I always seem to get this error:
undefined method
update' for "A1F83G8C2ARO7P":String`
line of code calling this is :
client.get_product_categories_for_asin(asin, marketplace_code).parse
I can use the same code but change to get_matching_product_for_asin and it will return results. It looks as though it is any method that just accepts a single sku or asin where it is not working as I tried with
get_lowest_priced_offers_for_sku
And the same error occurs.
There is also two methods in the Products section named the same:
#get_lowest_priced_offers_for_sku(asin, item_condition, opts = { marketplace_id: primary_marketplace_id }) ⇒ Peddler::XMLParser
#get_lowest_priced_offers_for_sku(seller_sku, item_condition, opts = { marketplace_id: primary_marketplace_id }) ⇒ Peddler::XMLParser
Thanks
Hello there,
I've got the issue that i get a bad request error during submit_feed . The curious thing is that the same process work in version 0.9.2. Now i'm using version 0.16.0
I've used this to make a new client:
client = MWS.feeds(
primary_marketplace_id: 'A1F83G8C2ARO7P',
merchant_id: xxx,
aws_access_key_id: xxx,
aws_secret_access_key: xxx
)
Then I create my latin1 string to set it in the first parameter(feed_content) of method "submit feed" and set as second paramter the feed_type:
client.submit_feed(latin_1_string, '_POST_FLAT_FILE_LISTINGS_DATA_').parse
The trace look like this:
from /home/stravas/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/excon-0.39.6/lib/excon/middlewares/expects.rb:6:in `response_call'
from /home/stravas/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/excon-0.39.6/lib/excon/middlewares/response_parser.rb:8:in `response_call'
from /home/stravas/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/excon-0.39.6/lib/excon/connection.rb:363:in `response'
from /home/stravas/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/excon-0.39.6/lib/excon/connection.rb:233:in `request'
from (eval):3:in `post'
from /home/stravas/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/peddler-0.16.0/lib/peddler/client.rb:173:in `run'
from /home/stravas/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/peddler-0.16.0/lib/mws/feeds/client.rb:27:in `submit_feed'
from (irb):16
from /home/stravas/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.1.1/lib/rails/commands/console.rb:90:in `start'
from /home/stravas/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.1.1/lib/rails/commands/console.rb:9:in `start'
from /home/stravas/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:69:in `console'
from /home/stravas/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from /home/stravas/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/railties-4.1.1/lib/rails/commands.rb:17:in `<top (required)>'
from /home/stravas/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require'
from /home/stravas/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `block in require'
from /home/stravas/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:in `load_dependency'
from /home/stravas/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:247:in `require'
from /home/stravas/Documents/Projects/wandfabrik-web/bin/rails:8:in `<top (required)>'
from /home/stravas/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:241:in `load'
from /home/stravas/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:241:in `block in load'
from /home/stravas/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:232:in `load_dependency'
from /home/stravas/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activesupport-4.1.1/lib/active_support/dependencies.rb:241:in `load'
from /home/stravas/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/stravas/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
This worked fine in peddler version 0.9.2 except that i used marketplace_id in client instead of primary_marketplace_id. This was the only thing i've changed after update to 0.16.0. But now i only get the bad request exception. I've also tried on different marketplaces but always with the same result.
Maybe i miss something.
Thanks for helping.
Hello,
I am trying to use get_my_fees_estimate in the docs it says to submit a hash with request details. My hash looks like this: {"MarketplaceId": 'ATVPDKIKX0DER', "IdType": "ASIN", "IdValue": "B01CVGV66W", "PriceToEstimateFees": 39.73, "Identifier": Time.now, "IsAmazonFulfilled": "true"}
My parsed return looks like this:
{"FeesEstimateResultList"=>{"FeesEstimateResult"=>{"FeesEstimateIdentifier"=>{"SellerId"=>"A20YSPW1I1I0OV", "IsAmazonFulfilled"=>"false", "SellerInputIdentifier"=>"2016-09-20T12:33:32-04:00"}, "Error"=>{"Code"=>"InvalidParameterValue", "Message"=>"IdType cannot be empty.", "Type"=>"Sender"}, "Status"=>"ClientError"}}}
As you can see the "IsAmazonFulfilled"=>"false" when I tried to set it to true.
What am I doing wrong?
Could someone please post an example hash in the docs?
Thanks!!!
Just wanted to say thanks for developing this, it has helped me a lot getting useful data from Amazon.
Im using Peddler 0.15.0 and Im trying to get report request list by using :requested_to_date and :requested_from_date as filters. It seems to me that the requested_to_date is filtering agains the "SubmittedDate" rather than the EndDate. (see my testing below).
In the documentation, http://docs.developer.amazonservices.com/en_US/reports/Reports_GetReportRequestList.html
the description for the RequestedToDate variable is:
"The end of the date range used for selecting the data to report, in ISO8601 date format."
Is this a bug ? Or am I misunderstanding here :)
Testing results
Report info:
=> {"ReportRequestInfo"=>{"StartDate"=>"2015-04-20T00:00:00+00:00", "CompletedDate"=>"2015-04-21T10:09:22+00:00", "Scheduled"=>"false", "ReportType"=>"GET_AMAZON_FULFILLED_SHIPMENTS_DATA", "GeneratedReportId"=>"56688023803", "ReportProcessingStatus"=>"DONE", "SubmittedDate"=>"2015-04-21T10:08:57+00:00", "EndDate"=>"2015-04-20T23:59:59+00:00", "StartedProcessingDate"=>"2015-04-21T10:09:14+00:00", "ReportRequestId"=>"50366016546"}, "HasNext"=>"false"}
Test with :requested_to_date < "SubmittedDate" => Returns no data
1.9.3-p551 :048 > test=client_reports.get_report_request_list(:report_type_list=>"GET_AMAZON_FULFILLED_SHIPMENTS_DATA", :requested_from_date=>1.day.ago.midnight, :report_processing_status_list=>"DONE", :requested_to_date=>"2015-04-21T10:08:56+00:00").parse
=> {"HasNext"=>"false"}
Test with :requested_to_date = "SubmittedDate" => Returns data
1.9.3-p551 :049 > test=client_reports.get_report_request_list(:report_type_list=>"GET_AMAZON_FULFILLED_SHIPMENTS_DATA", :requested_from_date=>1.day.ago.midnight, :report_processing_status_list=>"DONE", :requested_to_date=>"2015-04-21T10:08:57+00:00").parse
=> {"ReportRequestInfo"=>{"StartDate"=>"2015-04-20T00:00:00+00:00", "CompletedDate"=>"2015-04-21T10:09:22+00:00", "Scheduled"=>"false", "ReportType"=>"GET_AMAZON_FULFILLED_SHIPMENTS_DATA", "GeneratedReportId"=>"56688023803", "ReportProcessingStatus"=>"DONE", "SubmittedDate"=>"2015-04-21T10:08:57+00:00", "EndDate"=>"2015-04-20T23:59:59+00:00", "StartedProcessingDate"=>"2015-04-21T10:09:14+00:00", "ReportRequestId"=>"50366016546"}, "HasNext"=>"false"}
Hey the above is my code:
client = MWS::Orders::Client.new(
primary_marketplace_id:ENV['MARKETPLACE_ID'],
merchant_id: ENV['MERCHANT_ID'],
aws_access_key_id: ENV['AWS_ACCESS_KEY_ID'],
aws_secret_access_key: ENV['AWS_SECRET_ACCESS_KEY']
)
puts client.list_orders
Im trying to get the list of orders, it is not working it shows:
response_call': Expected(200) <=> Actual(400 Bad Request) (Excon::Errors::BadRequest)
I tried
puts client.list_orders()
but did not work, what am I doing wrong?, is mandatory send options?
I have some issues with the Inbound Shipment operation today. When i tried create shipment plan and update shipment, i get this error back:
{
"ErrorResponse": {
"xmlns": "http://mws.amazonaws.com/FulfillmentInboundShipment/2010-06-01-BETA-02/",
"Error": {
"Type": "Sender",
"Code": "InvalidAction"
},
"RequestId": "647829a0-3096-455c-9a35-a89e36c526dc"
}
}
Its using the old version (2010-06-01-beta). I know the code works before
I find out if i add the version params to the query which amazon's scratch pad also have this in the query even the url already specify the version, it fix the issue. I added that to the code and make a PR (#35) for that, hope it will help.
I'm trying to set up outbound fulfillment orders. I get a 400 response every time I try with no further detail so it's hard to figure out what's going wrong. This is my call:
@client.create_fulfillment_order("186", "186", 2016-08-01T07:35:48Z, "Test shipment number: 186", "Standard", {"Name"=>"Bert the Destroyer", "Line1"=>"Teststreet", "Line2"=>"123", "Line3"=>"", "DistrictOrCounty"=>"", "City"=>"Testcity", "StateOrProvinceCode"=>"CO", "CountryCode"=>"US", "PostalCode"=>"60401", "PhoneNumber"=>"12345678"}, [{"SellerSKU"=>"4785000045", "SellerFulfillmentOrderItemId"=>"4785000045", "Quantity"=>15}], {:fulfillment_policy=>"FillAll", :notification_email_list=>["[email protected]"]})
I followed the documentation to the best of my ability but can't find my issue. Unfortunately can't find any examples either. Any help would be greatly appreciated.
Edit: after some more digging I found this:
<Code>InvalidRequestException</Code>
<Message>Value AllQuantityZero for parameter is invalid.</Message>
GetMyFeesEstimate is not currently present in the Products client, but is a really useful call. Any reason you are not supporting it currently?
I was trying to set up peddler and after I put my marketplace_id, merchant_id etc and start the server the following error is returned: gems/peddler-0.12.7/lib/peddler/marketplace.rb:44:in `block in find_host': Peddler::Marketplace::BadId (Peddler::Marketplace::BadId)
I'm using Ruby 2.1.3 and Rails 4.2.0
Any ideas how to fix it?
I'm having trouble getting real parameters to work based on the example in this test:
@client.stub(:run, nil) do
@client.list_inbound_shipments(
shipment_status_list: [{ 'Foo' => '1' }],
shipment_id_list: [{ 'Bar' => '2' }])
end
I've tried:
begin
client.list_inbound_shipments(shipment_status_list: [{ 'WORKING' => '1' }])
rescue => e
puts e.response.body
end
<ErrorResponse xmlns="http://mws.amazonaws.com/FulfillmentInboundShipment/2010-10-01/">
<Error>
<Type>Sender</Type>
<Code>MalformedInput</Code>
<Message>Start of list found where not expected</Message>
</Error>
<RequestId>3ee3bfa1-0cce-455d-be13-b42925f1dfe3</RequestId>
</ErrorResponse>
Any thoughts?
I've been trying with different versions of this hash, but can't get it to work!!! Any help is MUCH appreciated..
ship_from_address = {
"Name" => "Company name",
"AddressLine1" => "929 Whatever Dr.",
"City" => "My Town",
"StateOrProvinceCode" => "YY",
"PostalCode" => "12345"
}
I know the client is setup correctly, I can request other more simple info from the API.. just my address format is somehow wrong I think!!
As a buyer, seller, and website, we want to know the product prices on Amazon so that we may make MONEY.
I'm imagining an API along the lines of:
client.products.get_competitive_pricing sku: '123'
client.products.get_my_price sku: '123'
client.products.get_competitive_pricing asin: '1234567890'
client.products.get_service_status
Amazon is very verbose. Let's try to make the API less wordy without moving too much away from their verbage.
Hakan,
We have started using peddler recently to loop thru our orders to get both order and customer info.
We have been playing with the cycle time in order to not bump up against AMS’s throttle limit, and thus far a cycle of one request every 60 seconds has yielded the “most” results. Although after running for approx. two hours it finally error-ed out with the following:
Excon::Errors::ServiceUnavailable: Expected(200) <=> Actual(503 Service Unavailable)
And now when ran (even with a cycle of 75 seconds) it is error-ing with: Excon::Errors::SocketError: getaddrinfo: nodename nor servname provided, or not known (SocketError)
After googling this seems to be related to either AMS or the fog gem, since I don’t see the fog gem in your code I am assuming it’s just AMS…
Do you have any insight on either the error and/or the best way to loop thru orders (or just AMS info in general)
response = order.get_order(["XXX-9942539-XXXXXXX", "XXX-8276410-XXXXXXX"])
order_info = response.parse
puts order_info
=> Returns nil (where it works for single orders)
The documentation says it can take upto 50 orders as input
Tab-Delimited responses seem to fall into two categories:
Regular files contain headers, need to be force-encoded into Windows-31J in Japan and ISO-8859-1 elsewhere. They also include double quotes, which need to be handled when parsing.
Feed processing summaries have two extra rows at the top summarising number of records processed and how many were successful. Tab-delimited content of failures follow.
This will require some rethinking of the way I laid out parsers, as the parser now has to know about the marketplace of the request and do some evaluation of the content to decide which category it falls into. Also, there is the problem where some requests to an endpoint return XML and others return tab-delimited text.
An earlier attempt at a parser, which should serve as a blueprint:
require 'csv'
require 'forwardable'
class CSVParser
extend Forwardable
include Enumerable
def_delegator :parsed_content, :each
attr :content, :encoding
def initialize(content, encoding)
@content = content
@encoding = encoding
end
def parsed_content
@parsed_content ||= parse_content
end
private
def parse_content
# http://stackoverflow.com/questions/8073920/importing-csv-quoting-error-is-driving-me-nuts
CSV.parse(scrub_content, col_sep: "\t", quote_char: "\x00", headers: true)
end
def scrub_content
content.force_encoding(encoding).encode('UTF-8')
end
end
client = MWS::Orders::Client.new(
primary_marketplace_id: 'xxxxxxxxx',
merchant_id: 'xxxxxxxxxx',
aws_access_key_id: 'xxxxxxxxx',
aws_secret_access_key: 'xxxxxxxxxx',
auth_token: 'xxxxxxxxx'
)
list_order_items = client.list_order_items('111-111111111-111').parse
puts '!!!!!!!!'
puts list_order_items
puts '!!!!!!!!'
rails runner test.rb
I want to get TAX/VAT by marketplaces from Amazon API via gem peddler. How can I get tax/vat values?
Hey, hakanensari, not sure where/how else to ask this but I'm using peddler to load a list of MWS settlement reports into my application. After properly setting the client, I am writing this to request up to 100 reports (the max) starting at 2 years ago:
reports = client.get_report_list(available_from_date: 2.years.ago.iso8601, report_type_list: "_GET_V2_SETTLEMENT_REPORT_DATA_XML_", max_count: 100)
For the life of me, I cannot figure out why only 5 reports are getting returned (HasNext is set to false so it is not an issue of using the next token which I am doing). I have way more than 5 settlement reports in Amazon. It seems to be taking in the parameters just fine: if I change available_from_date
to say 1.day.ago.iso8601
, nothing is returned. It is also properly returning only reports with a report_type_list of "GET_V2_SETTLEMENT_REPORT_DATA_XML". It just seems like when I expand the available_from_date
, it still goes back only 90 days (the default). Is that the max? The docs from Amazon say "The GetReportList operation returns a list of reports that were created in the previous 90 days that match the query parameters", but also says that the AvailableFromDate is "The earliest date you are looking for".
If the maximum is 90 days, can you think of another way that I could retrieve all my settlement reports?
Thanks in advance!
Suggested change:
mws/fulfillment_inbout_shipment/client.rb:87
.structure!(shipment_type == 'SP' : 'PackageList' ? 'PalletList', 'member')
Double get_lowest_priced_offers_for_sku
here
http://www.rubydoc.info/github/hakanensari/peddler/MWS/Products/Client
@hakanensari
I see the file marketplace.rb have assign the response encoding to Peddler::Parser
like FlatFileParser
.
But i found recently amazon (US, DE) has change the report api (flat file) encoding from 'ISO-8859-1' to 'Cp1252' and i found this article
These affect something like this:
s = "™"
s.encoding #>#<Encoding:UTF-8>
s.encode('cp1252') #>"\x99"
s.encode('ISO-8859-1') #>Encoding::UndefinedConversionError: U+2122 from UTF-8 to ISO-8859-1....
So i think we should move ISO-8859-1 to Cp1252. Cp1252 can hold all char in iso-8859-1and some other latin chars.
attach with some response returned with Amazon Scratchpad
(I only have US and DE account for amaozn mws, so only test US and DE market)
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.