Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: No action in fulfill order in rest API

No action in fulfill order in rest API

pawanpackage7
Shopify Partner
1 0 0

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

 

Reply 1 (1)

RobZone
Shopify Staff
77 11 23

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.