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.

Re: Error creating a fulfillment

Error creating a fulfillment

kjdointhings
Shopify Partner
29 2 12

Getting an error when trying to create a fulfillment. Use case is that I want to automatically fulfill digital line items in an order that do not require shipping.

 

I have gotten the fulfillment order ID from the following endpoint:

 

/admin/api/2024-01/orders/<ORDER_ID>/fulfillment_orders.json

 

And trying to use this endpoint with the fulfillment order ID and fulfillment order line item ID:

 

/admin/api/2024-01/fulfillments.json

 

And getting the following error:

 

 

{
    "errors": {
        "fulfillment": "Required parameter missing or invalid"
    }
}

 

 

My request body:

 

 

{
  "api_version": "2024-01",
  "notify_customer": true,
  "line_items_by_fulfillment_order": [
    {
      "fulfillment_order_id": 6596237721XXX,
      "fulfillment_order_line_items": [
        {
          "id": 14564806754XXX,
          "quantity": 1
        }
      ]
    }
  ]
}

 

Anyone run into this issue before? All the required parameters are there and should be correct. 

Replies 2 (2)

Liam
Community Manager
3108 344 904

 

Hi Kjdointhings,

 

Can you double-check that all required fields are correctly included and formatted in your request. This includes fulfillment_order_id and line_items with their id and quantity. Also the api_version field in your request body is unusual. Typically, the API version is specified in the URL or headers, not in the request body. You may want to remove this field from your payload.

 

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me 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

kjdointhings
Shopify Partner
29 2 12

The API docs say that api_version (string) is a required parameter for the /admin/api/2024-01/fulfillments.json endpoint. I was able to get this working though. The body of the request needs a top level "fulfillment" property. So my code from above needed to be: 

 

{
  "fulfillment": {
    "api_version": "2024-01",
    "notify_customer": true,
    "line_items_by_fulfillment_order": [
      {
        "fulfillment_order_id": 6596237721XXX,
        "fulfillment_order_line_items": [
          {
            "id": 14564806754XXX,
            "quantity": 1
          }
        ]
      }
    ]
  }
}