Update a Network Security Group

Note: Only contract administrators, owners, and users with permissions to the VDC concerned can create and manage NSGs via API.

Prerequisite: You need an IONOS Cloud account with API credentials configured with the appropriate permissions.

To update a NSG, you need to use the following Cloud API PUTor PATCH request providing the datacenterId, securityGroupIdand the required properties:

PUT(PATCH) /datacenters/{datacenterId}/securitygroups/{securityGroupId}

Request

curl --location --request PUT 'https://api.ionos.com/cloudapi/v6/datacenters/5a88aa8b-8aa1-51f6-XXd1-XXXXXe9f31/securitygroups/b3f55c2d-a89e-4008-8213-92e0428e2555' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic YYXabCDeFmLMO0c2hyYUBpb25vcy5jb206I1Bha2lzdGFuXzE=' \
--data '{
    "properties": {
        "name": "NSG",
        "description": "updated to true"
    }

}'

Response

202 Accepted

{
    "id": "bxxxx-axXX-0008-8888-99k0444e5555",
    "type": "security-group",
    "href": "https://api.ionos.com/cloudapi/v6/datacenters/5a88aa8b-8aa1-51f6-XXd1-XXXXXe9f31/securitygroups/bxxxx-axXX-0008-8888-99k0444e5555",
    "metadata": {
        "etag": "e15475860e9c6e1136ba1b2153297f31",
        "createdDate": "2024-05-17T15:11:11Z",
        "createdBy": "test.test@ionos.com",
        "createdByUserId": "a5af0375-1c1d-4387-9ef1-6ee95d30e54a",
        "lastModifiedDate": "2024-05-21T18:02:41Z",
        "lastModifiedBy": "test.test@ionos.com",
        "lastModifiedByUserId": "a5af0375-1c1d-4387-9ef1-6ee95d30e54a",
        "state": "BUSY"
    },
    "properties": {
        "name": "NSG",
        "description": "updated to true"
    },
    "entities": {
        "rules": {
            "id": "b3f55c2d-a89e-4008-8213-92e0428e2555/rules",
            "type": "collection",
            "href": "https://api.ionos.com/cloudapi/v6/datacenters/5a88aa8b-8aa1-51f6-XXd1-XXXXXe9f31/securitygroups/bxxxx-axXX-0008-8888-99k0444e5555/rules"
        },
        "servers": {
            "id": "b3f55c2d-a89e-4008-8213-92e0428e2555/servers",
            "type": "collection",
            "href": "https://api.ionos.com/cloudapi/v6/datacenters/5a88aa8b-8aa1-51f6-XXd1-XXXXXe9f31/securitygroups/bxxxx-axXX-0008-8888-99k0444e5555/servers"
        },
        "nics": {
            "id": "b3f55c2d-a89e-4008-8213-92e0428e2555/nics",
            "type": "collection",
            "href": "https://api.ionos.com/cloudapi/v6/datacenters/5a88aa8b-8aa1-51f6-XXd1-XXXXXe9f31/securitygroups/bxxxx-axXX-0008-8888-99k0444e5555/nics"
        }
    }
}

Note: For CloudAPI, some resources are created asynchronously. You can check for the progress via the Status URL that is returned in the response header of the POST or PUT call.

Last updated