Error while creating Fulfillment via API

Using the fullfillment API , to create fullfillment but getting :

422 Unprocessable Content

{
“errors”: [
“Fulfillment payloads fulfillment order must be greater than 0”
]
}

Request :

{
“fulfillment”: {
“location_id”: 78882865367,
“tracking_number”: “123456789”,

“line_items_by_fulfillment_order”: [
{
“id”: 14073330565335,
“quantity”: 1
}
]
}
}

This is Amelia from PageFly - Landing Page Builder App

To troubleshoot and resolve this issue, please follow these steps:

  1. Include Fulfillment Order ID:
    Ensure that the line_items_by_fulfillment_order array contains the fulfillment_order_id for each line item. This ID is crucial for the API to process the fulfillment correctly.

  2. Correct Request Format:
    Make sure your request includes the fulfillment_order_id. Here’s an example of how your request should be structured:

    json

{
  "fulfillment": {
    "location_id": 78882865367,
    "tracking_number": "123456789",
    "line_items_by_fulfillment_order": [
      {
        "fulfillment_order_id": 1234567890,  // Replace with the actual fulfillment order ID
        "line_items": [
          {
            "id": 14073330565335,
            "quantity": 1
          }
        ]
      }
    ]
  }
}​

Please review this AI-generated code and use it carefully. For more information, refer to the FAQ.

  1. Retrieve Fulfillment Order ID:
    If you don’t have the fulfillment_order_id, you’ll need to retrieve it first. Make a GET request to the Fulfillment Orders endpoint using the following format:
GET /admin/api/2023-10/orders/{order_id}/fulfillment_orders.json

This will return a list of fulfillment orders for the specified order, allowing you to obtain the fulfillment_order_id.

  1. Consult API Documentation:
    Refer to the Shopify Fulfillment API documentation for detailed information regarding the required parameters and request structure.

Hope that my solution works for you.

Best regards,

Amelia | PageFly