Solved

404 When i try fulfill order

piwni
Shopify Partner
2 0 0

Hello i have a problem with fulill order with on API version 2023-01

I have following curl 

curl --location --request POST 'https://matirejtest.myshopify.com/admin/api/2023-01/fulfillments.json' \
--header 'X-Shopify-Access-Token: xxxxx' \
--header 'Content-Type: application/json' \
--header 'Host: matirejtest.myshopify.com' \
--header 'User-Agent: SlinceShopifyClient/3.0.0' \
--data-raw '{
    "fulfillment": {
        "message": "The package was shipped this morning.",
        "notify_customer": false,
        "tracking_info": {
            "number": 1562678,        
            "company": "UPS"
        },
        "line_items_by_fulfillment_order": [
            {
                "fulfillment_order_id": 5249614217523,
                "fulfillment_order_line_items": [
                    {
                        "id": 13714980110643,
                        "quantity": 1
                    }
                ]
            }
        ]
    }
}'


I cant fulfill my order with this request. 
resulted in a `404 Not Found` response:\n
    {"errors":"Not Found"
I'm pretty sure that i have order with id 
5249614217523 and that order have single line item with id 
13714980110643 and quantity 1. 
I fetch this order also through API from endpoint 
"Retrieve a specific order"

I use package slince/shopify-api-php but i overwrite manager for create fufillment becouse it use old version of API 2022-04. Right now i make request on endpoint 
admin/api/2023-01/fulfillments.json

 

 
Accepted Solution (1)

PedroJShopify
Shopify Staff (Retired)
1 1 2

This is an accepted solution.

Hello Piwni,

 

What you need to use on "fulfillment_order_id" on the new API is the FulfillmentOrder ID instead of the Order ID. And the FulfillmentOrderLineItem ID instead of the Order's LineItem ID on "fulfillment_order_line_items".

 

FulfillmentOrder is a new concept introduced in newer versions of Shopify API, which represents a group of an order's line items that are intent to be fulfilled on the same location.

You can read more about it in our documentation:
https://shopify.dev/api/admin-rest/2023-01/resources/fulfillmentorder

 

You can discover an Order's Fulfillment Orders with this endpoint:
https://shopify.dev/api/admin-rest/2023-01/resources/fulfillmentorder#get-orders-order-id-fulfillmen...

 

If you are still facing issues please let us know.

To learn more visit the Shopify Help Center or the Community Blog.

View solution in original post

Replies 2 (2)

PedroJShopify
Shopify Staff (Retired)
1 1 2

This is an accepted solution.

Hello Piwni,

 

What you need to use on "fulfillment_order_id" on the new API is the FulfillmentOrder ID instead of the Order ID. And the FulfillmentOrderLineItem ID instead of the Order's LineItem ID on "fulfillment_order_line_items".

 

FulfillmentOrder is a new concept introduced in newer versions of Shopify API, which represents a group of an order's line items that are intent to be fulfilled on the same location.

You can read more about it in our documentation:
https://shopify.dev/api/admin-rest/2023-01/resources/fulfillmentorder

 

You can discover an Order's Fulfillment Orders with this endpoint:
https://shopify.dev/api/admin-rest/2023-01/resources/fulfillmentorder#get-orders-order-id-fulfillmen...

 

If you are still facing issues please let us know.

To learn more visit the Shopify Help Center or the Community Blog.

simochouchoudan
Tourist
11 0 1

hallo Piwni how can I run this code 

curl --location --request POST 'https://matirejtest.myshopify.com/admin/api/2023-01/fulfillments.json' \
--header 'X-Shopify-Access-Token: xxxxx' \
--header 'Content-Type: application/json' \
--header 'Host: matirejtest.myshopify.com' \
--header 'User-Agent: SlinceShopifyClient/3.0.0' \
--data-raw '{
    "fulfillment": {
        "message": "The package was shipped this morning.",
        "notify_customer": false,
        "tracking_info": {
            "number": 1562678,        
            "company": "UPS"
        },
        "line_items_by_fulfillment_order": [
            {
                "fulfillment_order_id": 5249614217523,
                "fulfillment_order_line_items": [
                    {
                        "id": 13714980110643,
                        "quantity": 1
                    }
                ]
            }
        ]
    }
}'


and what is
User-Agent: SlinceShopifyClient/3.0.0'

is this a library i should have in my machine to run the code
, thank you for your answer sorry am new to this.