Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

I’m using the v2 API to assign Floating IPs to different droplets. It’s working great in Postman, however i’m having some issues getting it to work in PHP with CURL. I’m not sure quite where i’m going wrong, any pointers would be greatly appreciated!
https://developers.digitalocean.com/documentation/v2/#floating-ip-actions
Error:
[id] => not_found
[message] => The specified action type is not available
Code:
/**
* Change where a Floating IP Points
*
* @param string $floatingIp
* @param int $dropletId
* @return array
*/
public function assignFloatingIp($floatingIp, $dropletId)
{
$data = array (
'type' => 'assign',
'droplet_id' => $dropletId
);
$response = $this->makeQuery('https://api.digitalocean.com/v2/floating_ips/'. $floatingIp .'/actions', 'POST', $data);
if (!array_key_exists('action', $response)) {
echo ucfirst($this->response['id']) . "<br>" . $this->response['message'];
}
return $response;
}
/**
* Make query
*
* @param string $url
* @param string $method
* @param array $data
* @return array
*/
private function makeQuery($url, $method = 'GET', $data = null)
{
try {
$headers = array('Authorization: Bearer '.$this->token);
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
if ($data) {
$data = json_encode($data);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
array_merge(
$headers,
array(
'Content-Type:application/json',
'Content-Length: ' . strlen($data)
)
);
}
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
//Data are stored in $data
$response = json_decode(curl_exec($curl), true);
curl_close($curl);
return $response;
} catch (Exception $e) {
return $e->getMessage();
}
}
donmez.dogan
41809fc37fa549b98a34934d238850
Código de referido Binance
yolanda smith
b1cfd497da4348d08019b0315db7a0
Deeraj EA
1ddffddc31ea402a842dcb134f6134
bec1cd09097d477da725b161a4066f
Anjanesh Lekshminarayanan
Anjanesh Lekshminarayanan
Md. Habibur Rahman Talukder Shamim
CCST