I am trying the latest API 2023/01 for fulfillment I am facing some random issues here is my code
curl --location --request POST 'https://devemo-theme.myshopify.com/admin/api/2023-01/fulfillments.json' \
--header 'X-Shopify-Access-Token: *' \
--header 'Content-Type: application/json' \
--data-raw '{
"fulfillment": {
"message": "The package was shipped this morning",
"line_items_by_fulfillment_order": [
{
"fulfillment_order_id": 4779534024889,
"fulfillment_order_line_items": [
{
"id": 11832026136761,
"quantity": 1
}
]
}
]
}
}'
X request ID a3f53c99-ff68-4b9f-ac17-df9ed21f8231
1 Like
Hey @JunaidT , I wasn’t able to track down the API call in our logs with the X-Request-ID you provided. Would you be able to share the error message you’re seeing or what the issue you’re encountering is? If there isn’t an error message, you can include the raw text of the response you received from Shopify as well.
Hope to hear from you soon - thanks!
I am working on the Shopify partner account store.
The response is
{
"errors": "Not Found"
}
1 Like
Having had the exact same issue that I resolved is the number ‘4779534024889’ your Order_ID or fulfillment order id?
/admin/api/2023-01/orders/ORDERID/fulfillment_orders.json
This endpoint is found in official documentation also tried that still not working for me sending request on this endpoint returns nothing(an empty response).
But what ID are you using?
Following the official documentation.
curl -X GET "https://your-development-store.myshopify.com/admin/api/2023-01/orders.json?status=any" \
-H "X-Shopify-Access-Token: TOKEN"
will return yourself something along the lines off.
HTTP/1.1 200 OK
{
"orders": [
{
"id": 450789469,
"admin_graphql_api_id": "gid://shopify/Order/450789469",
"app_id": null,
"browser_ip": "0.0.0.0",
Order Num, Order Id and fufillment ID are 3 different numbers. in this case 450789469
Then call the /admin/api/2023-01/orders/ORDERID/fulfillment_orders.json endpoint using the ID from orders.json this will give you the fulfillment_order_id that you can then call the fulfillments.json endpoint
You can get the fulfillments id directly from orders.json, but this sound like a ID issue.
Checked the orders.json and the id and line-items are exactly the same but still no response
There your problem
exact same issue I facing.
if you call fulfillment_order.json
curl -X GET "https://phatdev.myshopify.com/admin/api/2023-01/orders/4284094447825/fulfillment_orders.json" \
-H "X-Shopify-Access-Token: *token*"
for example, 4284094447825 being my order_id from orders.json.
will return the following json
{
"fulfillment_orders": [{
"id": 5332007420113,
"shop_id": 58793918673,
"order_id": 4284094447825,
"assigned_location_id": 64123011281,
"request_status": "unsubmitted",
......
the id here ( 5332007420113 ) can then be used to call fulfillments.json
curl -d '{"fulfillment":{"message":"The package was shipped this morning.","notify_customer":false,"tracking_info":{"number":1562678,"url":"https://www.my-shipping-company.com","company":"my-shipping-company"},"line_items_by_fulfillment_order":[{"fulfillment_order_id":5332007420113}]}}' \
-X POST "https://phatdev.myshopify.com/admin/api/2023-01/fulfillments.json" \
-H "X-Shopify-Access-Token: *TOKEN*" \
-H "Content-Type: application/json"
(Obviously change phatdev to your store) this should then return you the 201 (created) and mark the order as fulfilled.
2 Likes
Thank you your solution is good and worked for me as well.
Let me share the complete path so that if someone is facing the issue so they can fix it as well.
To Make an order fulfill you need a have a fulfillment id for each order id.
First Use this snippet to get all your orders.
curl --location --request GET 'https://store.myshopify.com/admin/api/2023-01/orders.json' \
--header 'X-Shopify-Access-Token: Token'
This will return all orders that are not fulfilled.
Take the first order id and use the code below.
curl --location --request GET 'https://store.myshopify.com/admin/api/2023-01/orders/order id/fulfillment_orders.json' \
--header 'X-Shopify-Access-Token: Token'
This will return the fulfillment id which is required to make the specific order fulfilled using API.
This is the last step you need to send the fulfillment id to the fulfillment endpoint.
curl --location --request POST 'https://store.myshopify.com/admin/api/2023-01/fulfillments.json' \
--header 'X-Shopify-Access-Token: Token' \
--header 'Content-Type: application/json' \
--data-raw '{
"fulfillment": {
"message": "The package was shipped this morning.",
"notify_customer": false,
"tracking_info": {
"number": 1562678,
"url": "https://www.my-shipping-company.com",
"company": "my-shipping-company"
},
"line_items_by_fulfillment_order": [
{
"fulfillment_order_id": Fulfillment ID HERE
}
]
}
}'
That is all I don’t know why they created a different endpoint to get the fulfillment id but this is how I am able to fulfill my order using API.
This is a bit annoying as not only I have to get the fulfillment Order ID header, I have to also retrieve the fulfillment order item line ID ??? So much unnecessary work just to move to this new API?
1 Like