Shipping method issue with RestAPI

I’m facing an issue with my REST API. I’ve created an interface for the API and am using the same function in both my REST and GraphQL APIs, with identical parameters.

The problem is: when I call the function through GraphQL, the TableRate shipping method is returned as expected. However, when I call the same function through REST API, the TableRate method is not returned.

Since the same function and parameters are used for both APIs, I’m not sure why the behavior is different.

webapi.xml

<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../app/code/Magento/Webapi/etc/webapi.xsd">
    <route method="POST" url="/V1/shippingcalculator-api/getShippingData">
        <service class="VendorExtensionApicustomInterface" method="getShippingData"/>
        <resources>
            <resource ref="anonymous"/>
        </resources>
    </route> 
</routes>

customInterface.php

<?php
 
namespace VendorExtensionApi;
 
interface customInterface
{
    /**
     * get shipping data
     * @param string $country
     * @param string $state
     * @param string $zipcode
     * @param int $quantity
     * @param int $product_id
     * @param int $store_id
     * @return string[]
     */
    public function getShippingData($country, $state, $zipcode, $quantity, $product_id, $store_id);
}

API Function

public function getShippingData($country, $state, $zipcode, $quantity, $product_id, $store_id)
    {
        $country = 'IN';
        $state = 'Gujarat';
        $zipcode = '364001';
        $quantity = 2;
        $product_id = 1;
        $store_id = 1;
 
        try {
            $response = [];
 
                try {
                    
                    $quote = $this->quote->create();
                    $quote->getShippingAddress()->setCountryId($country);
                    if ($state!=="") {
                        $collection = $this->regionCollectionFactory->create();
                        $collection->addFieldToFilter('default_name', $state)
                                   ->addFieldToFilter('country_id', $country);
                        $region = $collection->getFirstItem();
                        $state = $region->getId();
                        $quote->getShippingAddress()->setRegionId($state);
                    }
                    $quote->getShippingAddress()->setPostcode($zipcode);
                    $quote->collectTotals();
                    $quote->getShippingAddress()->setCollectShippingRates(true);
                    $quote->getShippingAddress()->collectShippingRates();
                    $response = ["status" => true,  "message"=>__("Fetch data..".count($rates))];
                    return json_encode($response);
                } catch (Exception $e) {
                     $response = ["status" => false, "message" => __($e->getMessage())];
                     return json_encode($response);
                }
              
           
            return json_encode($response);
        } catch (Exception $e) {
            $response = ["status" => false, "message" => __($e->getMessage())];
            return json_encode($response);
        }
    }