Controller/Adminhtml/FastlyCdn/Apply.php
public function execute()
    {
        $result = $this->resultJson->create();
        $from = $this->getRequest()->getParam('from');
        $to = $this->getRequest()->getParam('to');
        $sampleRate = $this->getRequest()->getParam('sample_rate');
        $region = $this->getRequest()->getParam('region');

        if (!$from || !$to) {
            return $result->setData([
                'status'    => false,
                'msg'       => 'Please enter dates.'
            ]);
        }

        /* Convert datetime to timestamp */
        $fromTimestamp = strtotime($from);
        $toTimestamp = strtotime($to);

        /* Parameters array */
        $parameters = [];
        $parameters['from'] = $fromTimestamp;
        $parameters['to'] = $toTimestamp;
        $parameters['sample_rate'] = $sampleRate;
        $parameters['region'] = $region;

        $queryResult = $this->api->queryHistoricStats($parameters);

        return $result->setData([
            'status'    => true,
            'stats'     => $queryResult
        ]);
    }
public function execute()
    {
        $result = $this->resultJson->create();
        $from = $this->getRequest()->getParam('from');
        $to = $this->getRequest()->getParam('to');
        $sampleRate = $this->getRequest()->getParam('sample_rate');
        $region = $this->getRequest()->getParam('region');

        if (!$from || !$to) {
            return $result->setData([
                'status'    => false,
                'msg'       => 'Please enter dates.'
            ]);
        }

        /* Convert datetime to timestamp */
        $fromTimestamp = strtotime($from);
        $toTimestamp = strtotime($to);

        /* Parameters array */
        $parameters = [];
        $parameters['from'] = $fromTimestamp;
        $parameters['to'] = $toTimestamp;
        $parameters['sample_rate'] = $sampleRate;
        $parameters['region'] = $region;

        $queryResult = $this->api->queryHistoricStats($parameters);

        return $result->setData([
            'status'    => true,
            'stats'     => $queryResult
        ]);
    }
Apply range

@return $this|\Magento\Framework\App\ResponseInterface|\Magento\Framework\Controller\ResultInterface