Getting {errors: Not Found} when trying to complete a fulfillment

Ahsan3
New Member
20 0 0

Hi, 

I have been trying to complete fulfillment using /admin/api/2021-01/orders/{order_id}/fulfillments/{fulfillment_id}/complete.json but it's giving me the following error:

{errors: Not Found }

 I have made sure that I am using the right fulfillment id and order id. I am not sure if I am missing something. Please Help!

Here's my payload:

$data = array(
            "fulfillment_request" => array(
                "message" => "Order has been completed successfully...",
            )
        );

        $API_KEY = env("SHOPIFY_API_KEY");
        $PASSWORD = env("SHOPIFY_API_PASSWORD");
        $SHOP_URL = env("SHOPIFY_MYSHOPIFY_DOMAIN");
        $SHOPIFY_API = "https://$API_KEY:$PASSWORD@$SHOP_URL//admin/api/2021-01/orders/".trim($request->orderId)."/fulfillments/".trim($request->fulfillmentId)."/complete.json";
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, $SHOPIFY_API);
        $headers = array(
            "Authorization: Basic ".base64_encode("$API_KEY:$PASSWORD"),
            "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, "POST");
        curl_setopt($curl, CURLOPT_TIMEOUT, 3600); //timeout after 60 Minutes
        curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
        curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);

        $response = curl_exec ($curl);
        curl_close ($curl);
0 Likes
Greg_Kujawa
Shopify Partner
1016 83 221

Can you use something like Postman (without sending client cookies) and successfully pass a POST request using the same data?

0 Likes
Ahsan3
New Member
20 0 0

Yes this is what I got 

404 Not Found

{
    "errors""Not Found"
}
Here is my X-request-id: ee0e252d-3daa-409d-b482-2baca2013efa
 
Is there anything else that I need to pass other than just "message"?
0 Likes
Greg_Kujawa
Shopify Partner
1016 83 221

Did you read the API docs? https://shopify.dev/docs/admin-api/rest/reference/shipping-and-fulfillment/fulfillment#complete-2021... Based on what I see there isn't any JSON request body passed along. Maybe try leaving that out and see what happens.

0 Likes
Ahsan3
New Member
20 0 0

Hi Greg,

Yes, I tried with the empty body as well but it is giving me the same error (404 not found). According to my understanding, I think there might be an issue with my "status".

1- When I am accepting a fulfillment, it gives me this status in response -> "status": "in_progress".

2- After successful acceptance, I am updating the tracking information and it gives me this status in response -> "status": "success".

3- After successfully updating the tracking info when I try to complete fulfillment, it gives me a not found error. 

I believe that status should change to success only after running completing a fulfillment call. Please correct me if I am wrong here or anything else I should take into consideration.

I even tried to pass "status"=> "open" in accepting a fulfillment call and in update tracking info call so that it will remain in an open state and will turn to success after completion but the status is not affecting at all from this and it is still showing me "status": "in_progress" in response after acceptance and "status": "success" after updating tracking info.

Please tell me if I am getting this not found error due to status and if yes then which status is correct for which call? and how can I change the status because right now passing status with open value is not working? 

 

0 Likes