Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

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

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

daniel_drysdale
Shopify Partner
2 0 4

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

Replies 5 (5)

ShopifyDevSup
Shopify Staff
1453 239 535

Hi @daniel_drysdale 👋


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

 

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

daniel_drysdale
Shopify Partner
2 0 4

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

Boneoh
Tourist
10 0 3

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!

Boneoh
Tourist
10 0 3

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

elizondro
Visitor
1 0 1

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