Retrieve Network Security Groups by 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 NSGs, you need to use the following Cloud APIGET request using the datacenter ID and securityGroupId:

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

Request

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

Response

200 OK

{
    "id": "b0a54xyz-abcd-8008-8883-XX0e0428e888",
    "type": "security-group",
    "href": "https://api.ionos.com/cloudapi/v6/datacenters/5a88aa8b-8aa1-51f6-XXd1-XXXXXe9f31/securitygroups/b0a54xyz-abcd-8008-8883-XX0e0428e888",
    "metadata": {
        "etag": "3a6a61187c03e11a41769e60a0610b54",
        "createdDate": "2024-05-17T15:11:11Z",
        "createdBy": "test.test@ionos.com",
        "createdByUserId": "XYaf0375-1c1d-4387-9ef1-6ee95d30e54a",
        "lastModifiedDate": "2024-05-17T15:11:11Z",
        "lastModifiedBy": "test.test@ionos.com",
        "lastModifiedByUserId": "XYaf0375-1c1d-4387-9ef1-6ee95d30e54a",
        "state": "AVAILABLE"
    },
    "properties": {
        "name": "My FWR",
        "description": null
    },
    "entities": {
        "rules": {
            "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"
        },
        "servers": {
            "id": "b0a54xyz-abcd-8008-8883-XX0e0428e888/servers",
            "type": "collection",
            "href": "https://api.ionos.com/cloudapi/v6/datacenters/5a88aa8b-8aa1-51f6-XXd1-XXXXXe9f31/securitygroups/b0a54xyz-abcd-8008-8883-XX0e0428e888/servers"
        },
        "nics": {
            "id": "b0a54xyz-abcd-8008-8883-XX0e0428e888/nics",
            "type": "collection",
            "href": "https://api.ionos.com/cloudapi/v6/datacenters/5a88aa8b-8aa1-51f6-XXd1-XXXXXe9f31/securitygroups/b0a54xyz-abcd-8008-8883-XX0e0428e888/nics"
        }
    }
}

Last updated