datacenter
key instead of assignee_id
. This can be either the ID or the name of the Datacenter this Primary IP shall be created in.Code | Description |
---|---|
server_not_stopped | The specified server is running, but needs to be powered off |
server_has_ipv4 | The server already has an ipv4 address |
server_has_ipv6 | The server already has an ipv6 address |
curl --location --request POST 'https://api.hetzner.cloud/v1/primary_ips' \
--header 'Content-Type: application/json' \
--data-raw '{
"assignee_id": 17,
"assignee_type": "server",
"auto_delete": false,
"datacenter": "fsn1-dc8",
"labels": {
"labelkey": "value"
},
"name": "my-ip",
"type": "ipv4"
}'
{
"action": {
"command": "create_primary_ip",
"error": {
"code": "action_failed",
"message": "Action failed"
},
"finished": null,
"id": 13,
"progress": 0,
"resources": [
{
"id": 17,
"type": "server"
}
],
"started": "2016-01-30T23:50:00.000Z",
"status": "running"
},
"primary_ip": {
"assignee_id": 17,
"assignee_type": "server",
"auto_delete": true,
"blocked": false,
"created": "2016-01-30T23:50:00.000Z",
"datacenter": {
"description": "Falkenstein DC Park 8",
"id": 42,
"location": {
"city": "Falkenstein",
"country": "DE",
"description": "Falkenstein DC Park 1",
"id": 1,
"latitude": 50.47612,
"longitude": 12.370071,
"name": "fsn1",
"network_zone": "eu-central"
},
"name": "fsn1-dc8",
"server_types": {
"available": [
1,
2,
3
],
"available_for_migration": [
1,
2,
3
],
"supported": [
1,
2,
3
]
}
},
"dns_ptr": [
{
"dns_ptr": "server.example.com",
"ip": "2001:db8::1"
}
],
"id": 42,
"ip": "131.232.99.1",
"labels": {
"labelkey": "value"
},
"name": "my-ip",
"protection": {
"delete": false
},
"type": "ipv4"
}
}