lineofflight / peddler

Amazon Selling Partner API (SP-API) in Ruby
MIT License
307 stars 130 forks source link

Bad Request when trying to get list of orders #45

Closed ssoulless closed 9 years ago

ssoulless commented 9 years ago

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?

ssoulless commented 9 years ago

I also tried

puts client.list_orders(created_before: Time.now.utc.iso8601)

But same result...

hakanensari commented 9 years ago

What's the error message?

begin
  client.list_orders
rescue => e
  puts e.response.message
end
ssoulless commented 9 years ago

Hi this is the error message:

CreatedAfter or LastUpdatedAfter must be specified

but I do not understand, what it means, what am I missing?

ssoulless commented 9 years ago

Hi I found the issue, I read Amazon MWS and it seems that you have to send the created_after argument mandatory:

client.list_orders(created_after: '2014-01-01')

Now it works, would be good if you add that detail to the docs, I mean add which ones are mandatory and which ones are not.

hakanensari commented 9 years ago

You're right. I'll add a note to the docs.