Python API - Problem trying to create a fulfillment record - API version 2023-01

I am updating my application to support the latest stable Shopify API (2023-01), but I am struggling with creating the fulfillment records.

Below is a sample fulfillment JSON “body” from my test store.

{
    "fulfillment": {
        "line_items_by_fulfillment_order": [
            {
                "fulfillment_order_id": "5894084460693",
                "fulfillment_order_line_items": [
                    {
                        "id": "12190922277013",
                        "quantity": "1"
                    }
                ]
            }
        ]
    }
}

if I POST this JSON from a REST client application, using the endpoint

admin/api/2023-01/fulfillments.json

then everything works fine.

If I try to POST the same thing via the Python API, “line_items_by_fulfillment_order” contains the objects & arrays that the JSON above was generated from

shopify.Fulfillment.create(line_items_by_fulfillment_order)

then the library tries to POST the JSON to the endpoint (which is expecting an order_id but won’t accept one)

admin/api/2023-01/orders//fulfillments.json

which then returns

HTTP Error 406: Not Acceptable

Clearly, I must be using the wrong resource when creating the fulfillment object, I have looked through the library source to try and see where I am going wrong, but I can’t figure out what the right resource is to generate the correct endpoint.

Any help would be greatly appreciated.

Cheers

Dan

3 Likes

Hi @daniel_drysdale :waving_hand:

Would you please create an issue on our public Shopify/shopify_python_api repo here?

1 Like

Hi,

I have opened an issue on the repo as requested, I also looked through the code and found a possible solution, I have raised a pull request on the repo for my solution.

I hadn’t signed the contributor license agreement at the time I raised the pull request but did so immediately after I saw the notice on the pull request, approx 3 days ago.

Just wondering what happens next in terms of having the pull request reviewed and hopefully accepted.

Cheers

Dan

1 Like

I am getting the same error. Curious to know if this has been fixed or any workarounds are available. I tried 2023-01 and 2023-04 and get

urllib.error.HTTPError: HTTP Error 406: Not Acceptable

Thanks in advance!

I gave up on the python ShopifyAPI library and just did a post of the json. Shopify line item fulfillment example python code

has this issue been resolved? i get the 406 No Acceptable status using POSTMAN

1 Like