Covers all questions related to inventory management, order fulfillment, and shipping.
Hi,
I am trying to fulfill my order by admin rest API, An it shows error when some parameter missing like location_id required etc, But when adding complete code, There is no response.
Here is my code.
<?php
$apiKey=XXXX;
$secKey=XXXX;
$adminToken=XXXX;
$storeName=XXXX;
$fulfill_data_new_1 = array(
"fulfillment" => array(
"message" => "The package was shipped.",
"notify_customer" => false,
"tracking_info" => array(
"number" => "123456TN",
"company" => "ABC"
),
"location_id"=>"84870463783",
)
);
$SHOPIFY_API = "https://$apiKey:$adminToken@$storeName/admin/api/2021-07/orders/".$order->shopify_id."/fulfillments.json";
$method="POST";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $SHOPIFY_API);
$headers = array(
"Authorization: Basic ".base64_encode("$apiKey:$adminToken"),
"Content-Type: application/json",
"charset: utf-8"
);
curl_setopt($curl, CURLOPT_HTTPHEADER,$headers);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_VERBOSE, 0);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
#curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($fulfill_data_new_1));
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
$response = curl_exec ($curl);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
echo $httpCode;
?>
Error code is 404,
Please let me know if anything wrong here.
Thanks
You are calling an API that has been deprecated and removed. The migration guide is here: https://shopify.dev/docs/apps/fulfillment/migrate
To learn more visit the Shopify Help Center or the Community Blog.