fr82
December 20, 2022, 11:27pm
1
I am sending a request to the fulfillment resource /admin/api/2022-10/fulfillments.json to mark one line item fulfilled.However I keep getting the following error :
"location_id must be specified when creating fulfillments "
I need help with understanding what I might be sending wrong(this is php):
$data = [
'fulfillment' => [
'message' => 'Fulfill Attempt',
'location_id' => 12345,
'notify_customer' => false,
'tracking_info' => [
'number' => 1234567,
'url' => 'fedex.com',
'company' => 'fedex',
],
'line_items_by_fulfillment_order' => [
[
'fulfillment_order_id' => $fulfillmentOrderId,
'fulfillment_order_line_items' => [
'line_item_id' => $lineItemId,
'quantity' => 1,
],
],
],
],
];
I have tried adding location_id in different spots. Some help with this will be much appreciated. I have also tried /admin/api/2022-07/fulfillments.json
e10jc
December 22, 2022, 5:01pm
2
When I add location_id, I get a 404 response.
Without location_id, I receive the same 400 error “location_id must be specified when creating fulfillments”.
Example args:
{ "line_items_by_fulfillment_order":[{"fulfillment_order_id":5700827480123,"fulfillment_order_line_items":[{"id":13047016030267,"quantity":1}]}],"notify_customer":true,"tracking_info":{"company":"FedEx","number":"392463695700"} }
mare46
January 5, 2023, 11:30am
3
I have the same issue using the admin api 2022-10. It doesnt matter if there is a location_id set in the fulfillment array or not, the error is still the same: [error] => location_id must be specified when creating fulfillments. Would be great to get an answer from the shopify pros soon
rpham
January 23, 2023, 10:36pm
4
This is the JSON schema that I used to create the fulfillment for orders and it worked.
{
"fulfillment": {
"location_id": 00000000000,
"line_items_by_fulfillment_order": [
{
"fulfillment_order_id": 00000000000,
"fulfillment_order_line_items": [
{
"id": 00000000000,
"shop_id": 00000000000,
"fulfillment_order_id": 00000000000,
"quantity": 1,
"line_item_id": 00000000000,
"inventory_item_id": 00000000000,
"fulfillable_quantity": 1,
"variant_id": 00000000000
}
]
}
],
"tracking_info": {
"company": "Fedex",
"number": "00000000000",
"url": "https://www.fedex.com/fedextrack/
trknbr=00000000000&trkqual=00000~00000000000~FDEG"
},
"notify_customer": true
}
}
maddos
March 28, 2023, 5:55pm
5
I just simply can’t get it. Is it so difficult to describe all mandatory fields for the request?
Why was it documented so badly here: https://shopify.dev/docs/api/admin-rest/2023-04/resources/fulfillment#post-fulfillments ?
Even in the request example there is no location_id set. And this is only 1 example. Almost every endpoit in shopify rest api documentation has some missing property, that are required for particular request.
Hi @maddos
Thanks for the feedback, we’re always looking to improve our docs and would really appreciate you also submitting feedback directly in the docs. There should be a “Was this section helpful?” block, and once you click “No”, there will be a section to comment on how it can be improved.
For the POST request to the fulfillments.json endpoint, it shouldn’t require a location_id to create a fulfillment. If you’re using the Shopify PHP library, I’d recommend submitting an issue in the public repo here.
maddos
March 29, 2023, 8:06am
7
Thank you for your response, but unfortunately the request example that you provide dosen’t work.
Here is my example
REQUEST:
{
“fulfillment”: {
“tracking_info”: {
“company”: “DHL”,
“number”: “222201010030243431”
},
"notify_customer ": true,
“line_items_by_fulfillment_order”: [
{
“fulfillment_order_id”: 4806734774445,
“fulfillment_order_line_items”: [
{
“id”: 12225550549165,
“quantity”: 1,
}
]
}
]
}
}
RESPONSE:
(POST https://{user}:{pw}@{shop}.myshopify.com/admin/api/2023-01/orders/4806734774445/fulfillments.json) 400
body: {“error”:“location_id must be specified when creating fulfillments.”}
maddos
March 29, 2023, 8:13am
8
Thank you for your response, unfortunately the request example that you provide doesn’t work.
Here is my example:
{
“fulfillment”: {
“tracking_info”: {
“company”: “DHL”,
“number”: “222201010030243431”
},
"notify_customer ": true,
“line_items_by_fulfillment_order”: [
{
“fulfillment_order_id”: 4806734774445,
“fulfillment_order_line_items”: [
{
“id”: 12225550549165,
“quantity”: 1,
“line_item_id”: null,
“fulfillment_order_id”: null
}
]
}
]
}
}
And Response that I’m getting:
Status 400,
body: {“error”:“location_id must be specified when creating fulfillments.”}
But even, if i set the location_id field, i’m getting another error:
Status 404,
message: “No content to map due to end-of-input”
How should i find out what fields are mandatory?
Thank you.
maddos
March 29, 2023, 8:17am
9
Thank you for your response, unfortunately the request example that you provide doesn’t work.
Here is my request example:
{
"fulfillment": {
"tracking_info": {
"company": "DHL",
"number": "222201010030243431"
},
"notify_customer ": true,
"line_items_by_fulfillment_order": [
{
"fulfillment_order_id": 4806734774445,
"fulfillment_order_line_items": [
{
"id": 12225550549165,
"quantity": 1,
"line_item_id": null,
"fulfillment_order_id": null
}
]
}
]
}
}
And Response that I’m getting:
Status 400,
body: {"error":"location_id must be specified when creating fulfillments."}
But even, if i set the location_id field, i’m getting another error:
Status 404,
message: “No content to map due to end-of-input”
How should i find out what fields are mandatory?
Thank you.