Cannot fulfill an order via API

_max
Tourist
3 0 1

I am trying to fulfill an order, but get an error. Please tell me what I am doing wrong:

 

Array
(
[errors] => Array
(
[fulfillment] => Required parameter missing or invalid
)

[http_code] => 400
[original_request] => {"fulfillment":{"api_version":"2023-10","notify_customer":false,"tracking_info":{"number":"TEST1234","url":"https://www.yodel.co.uk/track/TEST1234"},"line_items_by_fulfillment_order":{"fulfillment_order_id":6500782670097,"fulfillment_order_line_items":[{"id":14377671000337,"quantity":1}]}}}
[x_request_id] => 960002b8-10e9-409c-8835-c303c0295563
)

Replies 4 (4)
SBD_
Shopify Staff
Shopify Staff
1597 226 333

Hey @_max 

 

`line_items_by_fulfillment_order` should be an array (not a hash). Try:

 

{
  "fulfillment": {
    "api_version": "2023-10",
    "notify_customer": false,
    "tracking_info": {
      "number": "TEST1234",
      "url": "https://www.yodel.co.uk/track/TEST1234"
    },
    "line_items_by_fulfillment_order": [
      {
        "fulfillment_order_id": 6500782670097,
        "fulfillment_order_line_items": [
          {
            "id": 14377671000337,
            "quantity": 1
          }
        ]
      }
    ]
  }
}

 

Scott | Developer Advocate @ Shopify 

_max
Tourist
3 0 1

Hi Scott,

Well spotted, thanks, but I have updated this and still get the same error. Latest request ID: e76c49df-c856-4050-8390-9b7bbe68fe70

SBD_
Shopify Staff
Shopify Staff
1597 226 333

Thanks for the request ID. It looks like the params are wrapped in one too many `{}` and formatted weirdly. On this end we're receiving:

 

{"{\"fulfillment\":{\"api_version\":\"2023-10\",\"notify_customer\":false, ...

 

Can you show me a screenshot of how you send the request? (e.g. code/command/Postman)

Scott | Developer Advocate @ Shopify 

_max
Tourist
3 0 1

That makes some sense. I have added a content-type header and now all working perfectly. Thanks for the help!