1、生成Personal Access Token(API-Token)
密钥类似如下格式:
81d58e36224b63fc2gedac14342d0cfb16vf5451c798b2a38f976360410c4d09
2、获取DigitalOcean账户信息
需要curl,Bearer后跟API-Token
curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer 81d58e36224b63fc2gedac14342d0cfb16vf5451c798b2a38f976360410c4d09" "https://api.digitalocean.com/v2/account"
3、创建一个Droplet
方便阅读格式
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer 81d58e36224b63fc2gedac14342d0cfb16vf5451c798b2a38f976360410c4d09" -d ‘{ "name":"example.com", "region":"nyc3", "size":"512mb", "image":"ubuntu-14-04-x64", "ssh_keys":null, "backups":false, "ipv6":true, "user_data":null, "private_networking":null }‘ "https://api.digitalocean.com/v2/droplets"
单行格式
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer 81d58e36224b63fc2gedac14342d0cfb16vf5451c798b2a38f976360410c4d09" -d ‘{"name":"example.com","region":"nyc3","size":"512mb","image":"ubuntu-14-04-x64","ssh_keys":null,"backups":false,"ipv6":true,"user_data":null,"private_networking":null}‘ "https://api.digitalocean.com/v2/droplets"
时间: 2024-10-04 00:14:09