I am trying to call external api from Magento. Below is the request,
$client = $this->_httpClientFactory->create();
$client->setUri('thirdpartyurl.com/api/');
$client->setMethod(\Zend_Http_Client::PUT);
$client->setHeaders(\Zend_Http_Client::CONTENT_TYPE, 'application/json');
$client->setHeaders('Accept','application/json');
$client->setHeaders("Authorization","Bearer 1212121212121");
$client->setParameterPost($params); //json
$response= $client->request();
return $response->getBody();
Always response comes as
Unable to read response, or response is empty
Any help would be appreciated.