Attach a List of Security Groups to a Server or NIC
To attach a list of NSGs to a server, you need to use the following Cloud API PUT request providing the datacenterId,serverId and the IDs of the security groups in the body:
PUT /datacenters/{datacenterId}/servers/{serverId}/securitygroups
Similarly for a NIC, provide the datacenterId, nicId and the IDs of the security groups in the body:
PUT /datacenters/{datacenterId}/servers/{serverId}/nic/{nicId}/securitygroups
Request
curl --location --request PUT 'https://api.ionos.com/cloudapi/v6/datacenters/5a88aa8b-8aa1-51f6-XXd1-XXXXXe9f31/servers/bxxxx-axXX-0008-8888-99k0444e5555/securitygroups' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic YYXabCDeFmLMO0c2hyYUBpb25vcy5jb206I1Bha2lzdGFuXzE=' \
--data '{
"ids": [
"ac51b8e4-050c-4941-b7cd-43923422fe6e",
"ea737d87-8754-4a42-b97c-0b1a8f619de5"
]
}'Response
200 Accepted
Last updated
Was this helpful?