Cannot fulfill an order via API

Topic summary

A developer encountered a “Required parameter missing or invalid” error (HTTP 400) when attempting to fulfill an order via API.

Root Issues Identified:

  • line_items_by_fulfillment_order was incorrectly formatted as a hash instead of an array
  • Request parameters were wrapped in an extra set of curly braces {}
  • Missing or incorrect Content-Type header in the API request

Resolution:

After correcting the data structure to use proper array formatting and adding the appropriate Content-Type header, the fulfillment API calls began working successfully. The troubleshooting involved examining request IDs and reviewing the exact payload format being received by the server.

Summarized with AI on November 15. AI used: claude-sonnet-4-5-20250929.

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
)

Hey @_max_2

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
          }
        ]
      }
    ]
  }
}

Hi Scott,

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

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)

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

1 Like