Firewall rules

List firewall rules

get

List all firewall rules for the specified NIC.

Authorizations
Path parameters
datacenterIdstringRequired

The unique ID of the data center.

serverIdstringRequired

The unique ID of the server.

nicIdstringRequired

The unique ID of the NIC.

Query parameters
prettybooleanOptional

Controls whether the response is pretty-printed (with indentations and new lines).

Default: true
depthinteger · int32 · max: 10Optional

Controls the detail depth of the response objects. GET /datacenters/[ID] - depth=0: Only direct properties are included; children (servers and other elements) are not included. - depth=1: Direct properties and children references are included. - depth=2: Direct properties and children properties are included. - depth=3: Direct properties and children properties and children's children are included. - depth=... and so on

Default: 0
offsetinteger · int32Optional

The first element (from the complete list of the elements) to include in the response (used together with limit for pagination).

Default: 0
limitinteger · int32 · min: 1 · max: 10000Optional

The maximum number of elements to return (use together with offset for pagination).

Default: 1000
Header parameters
X-Contract-Numberinteger · int32Optional

Users with multiple contracts must provide the contract number, for which all API requests are to be executed.

Responses
200
Successful operation
application/json
get
GET /cloudapi/v6/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}/firewallrules HTTP/1.1
Host: api.ionos.com
Authorization: Basic username:password
Accept: */*
{
  "id": "15f67991-0f51-4efc-a8ad-ef1fb31a480c",
  "type": "collection",
  "href": "<RESOURCE-URI>",
  "items": [
    {
      "id": "15f67991-0f51-4efc-a8ad-ef1fb31a480c",
      "type": "firewall-rule",
      "href": "<RESOURCE-URI>",
      "metadata": {
        "etag": "45480eb3fbfc31f1d916c1eaa4abdcc3",
        "createdDate": "2015-12-04T14:34:09.809Z",
        "createdBy": "[email protected]",
        "createdByUserId": "[email protected]",
        "lastModifiedDate": "2015-12-04T14:34:09.809Z",
        "lastModifiedBy": "[email protected]",
        "lastModifiedByUserId": "63cef532-26fe-4a64-a4e0-de7c8a506c90",
        "state": "AVAILABLE"
      },
      "properties": {
        "name": "My resource",
        "protocol": "TCP",
        "sourceMac": "00:0a:95:9d:68:16",
        "ipVersion": "IPv4",
        "sourceIp": "22.231.113.64",
        "targetIp": "22.231.113.64",
        "icmpCode": 0,
        "icmpType": 8,
        "portRangeStart": 8,
        "portRangeEnd": 8,
        "type": "INGRESS"
      }
    }
  ],
  "offset": 0,
  "limit": 1000,
  "_links": {
    "prev": "<PREVIOUS-PAGE-URI>",
    "self": "<THIS-PAGE-URI>",
    "next": "<NEXT-PAGE-URI>"
  }
}

Create a Firewall Rule

post

Creates a firewall rule for the specified NIC.

Authorizations
Path parameters
datacenterIdstringRequired

The unique ID of the data center.

serverIdstringRequired

The unique ID of the server.

nicIdstringRequired

The unique ID of the NIC.

Query parameters
prettybooleanOptional

Controls whether the response is pretty-printed (with indentations and new lines).

Default: true
depthinteger · int32 · max: 10Optional

Controls the detail depth of the response objects. GET /datacenters/[ID] - depth=0: Only direct properties are included; children (servers and other elements) are not included. - depth=1: Direct properties and children references are included. - depth=2: Direct properties and children properties are included. - depth=3: Direct properties and children properties and children's children are included. - depth=... and so on

Default: 0
Header parameters
X-Contract-Numberinteger · int32Optional

Users with multiple contracts must provide the contract number, for which all API requests are to be executed.

Body
idstringRead-onlyOptional

The resource's unique identifier.

Example: 15f67991-0f51-4efc-a8ad-ef1fb31a480c
typeall ofOptional

The type of object that has been created.

Example: firewall-rule
string · enumOptionalPossible values:
hrefstring · uriRead-onlyOptional

URL to the object representation (absolute path).

Example: <RESOURCE-URI>
Responses
202
Successful operation
application/json
post
POST /cloudapi/v6/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}/firewallrules HTTP/1.1
Host: api.ionos.com
Authorization: Basic username:password
Content-Type: application/json
Accept: */*
Content-Length: 275

{
  "type": "firewall-rule",
  "metadata": {},
  "properties": {
    "name": "My resource",
    "protocol": "TCP",
    "sourceMac": "00:0a:95:9d:68:16",
    "ipVersion": "IPv4",
    "sourceIp": "22.231.113.64",
    "targetIp": "22.231.113.64",
    "icmpCode": 0,
    "icmpType": 8,
    "portRangeStart": 8,
    "portRangeEnd": 8,
    "type": "INGRESS"
  }
}
{
  "id": "15f67991-0f51-4efc-a8ad-ef1fb31a480c",
  "type": "firewall-rule",
  "href": "<RESOURCE-URI>",
  "metadata": {
    "etag": "45480eb3fbfc31f1d916c1eaa4abdcc3",
    "createdDate": "2015-12-04T14:34:09.809Z",
    "createdBy": "[email protected]",
    "createdByUserId": "[email protected]",
    "lastModifiedDate": "2015-12-04T14:34:09.809Z",
    "lastModifiedBy": "[email protected]",
    "lastModifiedByUserId": "63cef532-26fe-4a64-a4e0-de7c8a506c90",
    "state": "AVAILABLE"
  },
  "properties": {
    "name": "My resource",
    "protocol": "TCP",
    "sourceMac": "00:0a:95:9d:68:16",
    "ipVersion": "IPv4",
    "sourceIp": "22.231.113.64",
    "targetIp": "22.231.113.64",
    "icmpCode": 0,
    "icmpType": 8,
    "portRangeStart": 8,
    "portRangeEnd": 8,
    "type": "INGRESS"
  }
}

Retrieve firewall rules

get

Retrieve the properties of the specified firewall rule.

Authorizations
Path parameters
datacenterIdstringRequired

The unique ID of the data center.

serverIdstringRequired

The unique ID of the server.

nicIdstringRequired

The unique ID of the NIC.

firewallruleIdstringRequired

The unique ID of the firewall rule.

Query parameters
prettybooleanOptional

Controls whether the response is pretty-printed (with indentations and new lines).

Default: true
depthinteger · int32 · max: 10Optional

Controls the detail depth of the response objects. GET /datacenters/[ID] - depth=0: Only direct properties are included; children (servers and other elements) are not included. - depth=1: Direct properties and children references are included. - depth=2: Direct properties and children properties are included. - depth=3: Direct properties and children properties and children's children are included. - depth=... and so on

Default: 0
Header parameters
X-Contract-Numberinteger · int32Optional

Users with multiple contracts must provide the contract number, for which all API requests are to be executed.

Responses
200
Successful operation
application/json
get
GET /cloudapi/v6/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}/firewallrules/{firewallruleId} HTTP/1.1
Host: api.ionos.com
Authorization: Basic username:password
Accept: */*
{
  "id": "15f67991-0f51-4efc-a8ad-ef1fb31a480c",
  "type": "firewall-rule",
  "href": "<RESOURCE-URI>",
  "metadata": {
    "etag": "45480eb3fbfc31f1d916c1eaa4abdcc3",
    "createdDate": "2015-12-04T14:34:09.809Z",
    "createdBy": "[email protected]",
    "createdByUserId": "[email protected]",
    "lastModifiedDate": "2015-12-04T14:34:09.809Z",
    "lastModifiedBy": "[email protected]",
    "lastModifiedByUserId": "63cef532-26fe-4a64-a4e0-de7c8a506c90",
    "state": "AVAILABLE"
  },
  "properties": {
    "name": "My resource",
    "protocol": "TCP",
    "sourceMac": "00:0a:95:9d:68:16",
    "ipVersion": "IPv4",
    "sourceIp": "22.231.113.64",
    "targetIp": "22.231.113.64",
    "icmpCode": 0,
    "icmpType": 8,
    "portRangeStart": 8,
    "portRangeEnd": 8,
    "type": "INGRESS"
  }
}

Modify a Firewall Rule

put

Modifies the properties of the specified firewall rule.

Authorizations
Path parameters
datacenterIdstringRequired

The unique ID of the data center.

serverIdstringRequired

The unique ID of the server.

nicIdstringRequired

The unique ID of the NIC.

firewallruleIdstringRequired

The unique ID of the firewall rule.

Query parameters
prettybooleanOptional

Controls whether the response is pretty-printed (with indentations and new lines).

Default: true
depthinteger · int32 · max: 10Optional

Controls the detail depth of the response objects. GET /datacenters/[ID] - depth=0: Only direct properties are included; children (servers and other elements) are not included. - depth=1: Direct properties and children references are included. - depth=2: Direct properties and children properties are included. - depth=3: Direct properties and children properties and children's children are included. - depth=... and so on

Default: 0
Header parameters
X-Contract-Numberinteger · int32Optional

Users with multiple contracts must provide the contract number, for which all API requests are to be executed.

Body
idstringRead-onlyOptional

The resource's unique identifier.

Example: 15f67991-0f51-4efc-a8ad-ef1fb31a480c
typeall ofOptional

The type of object that has been created.

Example: firewall-rule
string · enumOptionalPossible values:
hrefstring · uriRead-onlyOptional

URL to the object representation (absolute path).

Example: <RESOURCE-URI>
Responses
202
Successful operation
application/json
put
PUT /cloudapi/v6/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}/firewallrules/{firewallruleId} HTTP/1.1
Host: api.ionos.com
Authorization: Basic username:password
Content-Type: application/json
Accept: */*
Content-Length: 275

{
  "type": "firewall-rule",
  "metadata": {},
  "properties": {
    "name": "My resource",
    "protocol": "TCP",
    "sourceMac": "00:0a:95:9d:68:16",
    "ipVersion": "IPv4",
    "sourceIp": "22.231.113.64",
    "targetIp": "22.231.113.64",
    "icmpCode": 0,
    "icmpType": 8,
    "portRangeStart": 8,
    "portRangeEnd": 8,
    "type": "INGRESS"
  }
}
{
  "id": "15f67991-0f51-4efc-a8ad-ef1fb31a480c",
  "type": "firewall-rule",
  "href": "<RESOURCE-URI>",
  "metadata": {
    "etag": "45480eb3fbfc31f1d916c1eaa4abdcc3",
    "createdDate": "2015-12-04T14:34:09.809Z",
    "createdBy": "[email protected]",
    "createdByUserId": "[email protected]",
    "lastModifiedDate": "2015-12-04T14:34:09.809Z",
    "lastModifiedBy": "[email protected]",
    "lastModifiedByUserId": "63cef532-26fe-4a64-a4e0-de7c8a506c90",
    "state": "AVAILABLE"
  },
  "properties": {
    "name": "My resource",
    "protocol": "TCP",
    "sourceMac": "00:0a:95:9d:68:16",
    "ipVersion": "IPv4",
    "sourceIp": "22.231.113.64",
    "targetIp": "22.231.113.64",
    "icmpCode": 0,
    "icmpType": 8,
    "portRangeStart": 8,
    "portRangeEnd": 8,
    "type": "INGRESS"
  }
}

Delete firewall rules

delete

Delete the specified firewall rule.

Authorizations
Path parameters
datacenterIdstringRequired

The unique ID of the data center.

serverIdstringRequired

The unique ID of the server.

nicIdstringRequired

The unique ID of the NIC.

firewallruleIdstringRequired

The unique ID of the firewall rule.

Query parameters
prettybooleanOptional

Controls whether the response is pretty-printed (with indentations and new lines).

Default: true
depthinteger · int32 · max: 10Optional

Controls the detail depth of the response objects. GET /datacenters/[ID] - depth=0: Only direct properties are included; children (servers and other elements) are not included. - depth=1: Direct properties and children references are included. - depth=2: Direct properties and children properties are included. - depth=3: Direct properties and children properties and children's children are included. - depth=... and so on

Default: 0
Header parameters
X-Contract-Numberinteger · int32Optional

Users with multiple contracts must provide the contract number, for which all API requests are to be executed.

Responses
202
Successful operation
delete
DELETE /cloudapi/v6/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}/firewallrules/{firewallruleId} HTTP/1.1
Host: api.ionos.com
Authorization: Basic username:password
Accept: */*

No content

Partially modify firewall rules

patch

Update the properties of the specified firewall rule.

Authorizations
Path parameters
datacenterIdstringRequired

The unique ID of the data center.

serverIdstringRequired

The unique ID of the server.

nicIdstringRequired

The unique ID of the NIC.

firewallruleIdstringRequired

The unique ID of the firewall rule.

Query parameters
prettybooleanOptional

Controls whether the response is pretty-printed (with indentations and new lines).

Default: true
depthinteger · int32 · max: 10Optional

Controls the detail depth of the response objects. GET /datacenters/[ID] - depth=0: Only direct properties are included; children (servers and other elements) are not included. - depth=1: Direct properties and children references are included. - depth=2: Direct properties and children properties are included. - depth=3: Direct properties and children properties and children's children are included. - depth=... and so on

Default: 0
Header parameters
X-Contract-Numberinteger · int32Optional

Users with multiple contracts must provide the contract number, for which all API requests are to be executed.

Body
namestringOptional

The name of the resource.

Example: My resource
protocolstring · enumRequired

The protocol for the rule. Property cannot be modified after it is created (disallowed in update requests).

Example: TCPPossible values:
sourceMacstring | nullableOptional

Only traffic originating from the respective MAC address is allowed. Valid format: aa:bb:cc:dd:ee:ff. Value null allows traffic from any MAC address.

Example: 00:0a:95:9d:68:16
ipVersionstring · enum | nullableOptional

The IP version for this rule. If sourceIp or targetIp are specified, you can omit this value - the IP version will then be deduced from the IP address(es) used; if you specify it anyway, it must match the specified IP address(es). If neither sourceIp nor targetIp are specified, this rule allows traffic only for the specified IP version. If neither sourceIp, targetIp nor ipVersion are specified, this rule will only allow IPv4 traffic.

Example: IPv4Possible values:
sourceIpstring | nullableOptional

Only traffic originating from the respective IP address (or CIDR block) is allowed. Value null allows traffic from any IP address (according to the selected ipVersion).

Example: 22.231.113.64
targetIpstring | nullableOptional

If the target NIC has multiple IP addresses, only the traffic directed to the respective IP address (or CIDR block) of the NIC is allowed. Value null allows traffic to any target IP address (according to the selected ipVersion).

Example: 22.231.113.64
icmpCodeinteger · int32 | nullableOptional

Defines the allowed code (from 0 to 254) if protocol ICMP or ICMPv6 is chosen. Value null allows all codes.

Example: 0
icmpTypeinteger · int32 | nullableOptional

Defines the allowed type (from 0 to 254) if the protocol ICMP or ICMPv6 is chosen. Value null allows all types.

Example: 8
portRangeStartinteger · int32 · min: 1 · max: 65535Optional

Defines the start range of the allowed port (from 1 to 65535) if protocol TCP or UDP is chosen. Leave portRangeStart and portRangeEnd value null to allow all ports.

Example: 8
portRangeEndinteger · int32 · min: 1 · max: 65535Optional

Defines the end range of the allowed port (from 1 to 65535) if the protocol TCP or UDP is chosen. Leave portRangeStart and portRangeEnd null to allow all ports.

Example: 8
typestring · enumOptional

The type of the firewall rule. If not specified, the default INGRESS value is used.

Example: INGRESSPossible values:
Responses
202
Successful operation
application/json
patch
PATCH /cloudapi/v6/datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}/firewallrules/{firewallruleId} HTTP/1.1
Host: api.ionos.com
Authorization: Basic username:password
Content-Type: application/json
Accept: */*
Content-Length: 223

{
  "name": "My resource",
  "protocol": "TCP",
  "sourceMac": "00:0a:95:9d:68:16",
  "ipVersion": "IPv4",
  "sourceIp": "22.231.113.64",
  "targetIp": "22.231.113.64",
  "icmpCode": 0,
  "icmpType": 8,
  "portRangeStart": 8,
  "portRangeEnd": 8,
  "type": "INGRESS"
}
{
  "id": "15f67991-0f51-4efc-a8ad-ef1fb31a480c",
  "type": "firewall-rule",
  "href": "<RESOURCE-URI>",
  "metadata": {
    "etag": "45480eb3fbfc31f1d916c1eaa4abdcc3",
    "createdDate": "2015-12-04T14:34:09.809Z",
    "createdBy": "[email protected]",
    "createdByUserId": "[email protected]",
    "lastModifiedDate": "2015-12-04T14:34:09.809Z",
    "lastModifiedBy": "[email protected]",
    "lastModifiedByUserId": "63cef532-26fe-4a64-a4e0-de7c8a506c90",
    "state": "AVAILABLE"
  },
  "properties": {
    "name": "My resource",
    "protocol": "TCP",
    "sourceMac": "00:0a:95:9d:68:16",
    "ipVersion": "IPv4",
    "sourceIp": "22.231.113.64",
    "targetIp": "22.231.113.64",
    "icmpCode": 0,
    "icmpType": 8,
    "portRangeStart": 8,
    "portRangeEnd": 8,
    "type": "INGRESS"
  }
}

Was this helpful?