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.

Hi all,
I’ve having some trouble understanding the API, in the past with other API’s I’ve just used a simple PHP with curl script to action a specific task on a service. I don’t need a full library and the Digital Ocean has more dependencies than I care to count…
For some reason the DO API is not working with a simple script like this while others do, I must be missing something?
function basic_api_handle($key, $method, $URI, $data) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Authorization: Bearer '.$key,
'Content-Type: application/json')
);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($ch, CURLOPT_URL, $URI);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
$result = curl_exec($ch);
if($result === false) error_log("API ERROR: Connection failure: $URI", 0);
curl_close($ch);
return json_decode($result, true);
}
var_dump(basic_api_handle($api_key, 'POST', 'https://api.digitalocean.com/v2/domains', array('name' => 'my-domain.tld', 'ip_address' => '1.2.3.4')));
This results in** “unprocessable_entity” **and “Name can’t be blank” - it suggests to me the data is not being sent correctly? although, as far as I can tell, it is…
I’ve also posted this on Stack Overflow but it may be to specific (Digital Ocean) to get any decent answers. I have setup a bounty for a solution too :) http://stackoverflow.com/questions/43619504/how-do-i-make-a-simple-php-api-handler/43854037
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