how to use MWS create_fulfillment_order?

60 views
Skip to first unread message

Martin Luessi

unread,
Apr 6, 2015, 9:44:52 AM4/6/15
to boto-...@googlegroups.com
Hi,

I'm trying to use boto to enter a fulfillment order using MWS. However, I get a "Bad request" error with the message "Top level element may not be treated as a list". My example code is below. I assume that there is a mistake with the way I submit "Items". Can anyone point me in the right direction?

Cheers,

Martin

from boto.mws.connection import MWSConnection
mws = MWSConnection(mws_access_key, mws_secret_key, Merchant=mws_seller_id)

address = dict(Name='John Doe', Line1='1 School Street', DistrictOrCounty='United States', City='Beverly Hills', 
               StateOrProvinceCode='CA', CountryCode='US', PostalCode='90210')
items = [dict(SellerSKU='2', SellerFulfillmentOrderItemId='2', Quantity='1')]

r = mws.create_fulfillment_order(SellerFulfillmentOrderId='XXX0911', DisplayableOrderId='XXX0911',
                                 DisplayableOrderDateTime='2015-04-05T07:00:00Z',
                                 DisplayableOrderComment='Thank you for your order!',
                                 ShippingSpeedCategory='Expedited',
                                 DestinationAddress=address,
                                 Items=items, FulfillmentAction='Hold')

Martin Luessi

unread,
Apr 6, 2015, 10:01:49 AM4/6/15
to boto-...@googlegroups.com

Adrian Klaver

unread,
Apr 6, 2015, 10:09:58 AM4/6/15
to boto-...@googlegroups.com
On 04/06/2015 07:01 AM, Martin Luessi wrote:
> I figured it out :). See https://github.com/boto/boto/issues/2808

Hmm, never would have figured that out, it does not mesh with the docs:

http://boto.readthedocs.org/en/latest/ref/mws.html

"... Items (ResponseElement or anything iterable/dict-like) ..."

There is actually a specific structure needed.
> --
> You received this message because you are subscribed to the Google
> Groups "boto-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to boto-users+...@googlegroups.com
> <mailto:boto-users+...@googlegroups.com>.
> To post to this group, send email to boto-...@googlegroups.com
> <mailto:boto-...@googlegroups.com>.
> Visit this group at http://groups.google.com/group/boto-users.
> For more options, visit https://groups.google.com/d/optout.


--
Adrian Klaver
adrian...@aklaver.com

Andy Davidoff

unread,
Apr 6, 2015, 11:29:46 AM4/6/15
to boto-...@googlegroups.com
On Apr 6, 2015, at 10:09 AM, Adrian Klaver <adrian...@aklaver.com> wrote:

> Hmm, never would have figured that out, it does not mesh with the docs:
>
> http://boto.readthedocs.org/en/latest/ref/mws.html
>
> "... Items (ResponseElement or anything iterable/dict-like) ..."
>
> There is actually a specific structure needed.

Correct, from my update to issue #2808…

It's a bug.

Find the `@structured_objects('DestinationAddress', 'Items')` decorator above the `create_fulfillment_order()` and add a `members=True` parameter to it; then the code as I wrote it above should work without the `dict(Member=...)` wrapper.

I would submit a PR but I am disinclined to do so until my previously accepted PR is actually merged; it seems the maintainers have too much on their plate.

--
Andy Davidoff
disruptek.com
1-877-DISRPTK

Adrian Klaver

unread,
Apr 6, 2015, 11:49:29 AM4/6/15
to boto-...@googlegroups.com
Unfortunately that seems to be a common issue these days. Too many
directions, not enough follow through.


--
Adrian Klaver
adrian...@aklaver.com
Reply all
Reply to author
Forward
0 new messages