Retrieve Firewall rules by Network Security Group ID

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 retrieve the firewall rules by Network Security Group ID, you need to use one of the following Cloud APIGET request using the datacenterId and securityGroupId:

GET /datacenters/{datacenterId}/securitygroups/{securityGroupId}/rules

GET /datacenters/{datacenterId}/securitygroups/{securityGroupId}/rules/{ruleId}

Request

curl --location 'https://api.ionos.com/cloudapi/v6/datacenters/5a88aa8b-8aa1-51f6-XXd1-XXXXXe9f31/securitygroups/b0a54xyz-abcd-8008-8883-XX0e0428e888/rules' \
--header 'Authorization: Basic YYXabCDeFmLMO0c2hyYUBpb25vcy5jb206I1Bha2lzdGFuXzE='

Response

200 OK

{
    "id": "b0a54xyz-abcd-8008-8883-XX0e0428e888/rules",
    "type": "collection",
    "href": "https://api.ionos.com/cloudapi/v6/datacenters/5a88aa8b-8aa1-51f6-XXd1-XXXXXe9f31/securitygroups/b0a54xyz-abcd-8008-8883-XX0e0428e888/rules",
    "items": [
        {
            "id": "0A0X0885-88ix-8xxX-1020-888a4f0f8137",
            "type": "firewall-rule",
            "href": "https://api.ionos.com/cloudapi/v6/datacenters/5a88aa8b-8aa1-51f6-XXd1-XXXXXe9f31/securitygroups/b0a54xyz-abcd-8008-8883-XX0e0428e888/rules/0A0X0885-88ix-8xxX-1020-888a4f0f8137"
        }
    ]
}

Last updated