# FirewallRulesApi

All URIs are relative to *<https://api.ionos.com/cloudapi/v6>*

| Method                                                                                          | HTTP request                                                                                          | Description                     |
| ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | ------------------------------- |
| [**datacentersServersNicsFirewallrulesDelete**](#datacentersserversnicsfirewallrulesdelete)     | **DELETE** /datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}/firewallrules/{firewallruleId} | Delete firewall rules           |
| [**datacentersServersNicsFirewallrulesFindById**](#datacentersserversnicsfirewallrulesfindbyid) | **GET** /datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}/firewallrules/{firewallruleId}    | Retrieve firewall rules         |
| [**datacentersServersNicsFirewallrulesGet**](#datacentersserversnicsfirewallrulesget)           | **GET** /datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}/firewallrules                     | List firewall rules             |
| [**datacentersServersNicsFirewallrulesPatch**](#datacentersserversnicsfirewallrulespatch)       | **PATCH** /datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}/firewallrules/{firewallruleId}  | Partially modify firewall rules |
| [**datacentersServersNicsFirewallrulesPost**](#datacentersserversnicsfirewallrulespost)         | **POST** /datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}/firewallrules                    | Create a Firewall Rule          |
| [**datacentersServersNicsFirewallrulesPut**](#datacentersserversnicsfirewallrulesput)           | **PUT** /datacenters/{datacenterId}/servers/{serverId}/nics/{nicId}/firewallrules/{firewallruleId}    | Modify a Firewall Rule          |

## datacentersServersNicsFirewallrulesDelete

> datacentersServersNicsFirewallrulesDelete(datacenterId, serverId, nicId, firewallruleId, opts)

Delete firewall rules

Delete the specified firewall rule.

### Examples

```javascript
const ionoscloud = require('@ionos-cloud/sdk-nodejs');
// setup authorization
const config = new ionoscloud.Configuration({
    username: 'YOUR_USERNAME',
    password: 'YOUR_PASSWORD',
    apiKey: 'YOUR_API_KEY'
});
const api_instance = new ionoscloud.FirewallRulesApi(config);
// Delete firewall rules
api_instance
  .datacentersServersNicsFirewallrulesDelete({
    datacenterId: datacenterId_example,
    serverId: serverId_example,
    nicId: nicId_example,
    firewallruleId: firewallruleId_example,
    pretty: true,
    depth: 56,
    xContractNumber: 56, 
        options: {}
  })
  .then((response) => console.log(response.data))
  .catch((error) => console.log(error.response.data));
```

### Parameters

| Name                | Type        | Description                                                                                                                                                                                                                                                                                                                                                                                                                                   | Notes                              |
| ------------------- | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
| **datacenterId**    | **string**  | The unique ID of the data center.                                                                                                                                                                                                                                                                                                                                                                                                             | \[default to undefined]            |
| **serverId**        | **string**  | The unique ID of the server.                                                                                                                                                                                                                                                                                                                                                                                                                  | \[default to undefined]            |
| **nicId**           | **string**  | The unique ID of the NIC.                                                                                                                                                                                                                                                                                                                                                                                                                     | \[default to undefined]            |
| **firewallruleId**  | **string**  | The unique ID of the firewall rule.                                                                                                                                                                                                                                                                                                                                                                                                           | \[default to undefined]            |
| **pretty**          | **boolean** | Controls whether the response is pretty-printed (with indentations and new lines).                                                                                                                                                                                                                                                                                                                                                            | \[optional]\[default to true]      |
| **depth**           | **number**  | 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\&#39;s children are included. - depth=... and so on | \[optional]\[default to 0]         |
| **xContractNumber** | **number**  | Users with multiple contracts must provide the contract number, for which all API requests are to be executed.                                                                                                                                                                                                                                                                                                                                | \[optional]\[default to undefined] |

### Return type

nil (empty response body)

### Authorization

Basic Authentication, Token Authentication

### HTTP request headers

* **Content-Type**: Not defined
* **Accept**: application/json

## datacentersServersNicsFirewallrulesFindById

> datacentersServersNicsFirewallrulesFindById(datacenterId, serverId, nicId, firewallruleId, opts)

Retrieve firewall rules

Retrieve the properties of the specified firewall rule.

### Examples

```javascript
const ionoscloud = require('@ionos-cloud/sdk-nodejs');
// setup authorization
const config = new ionoscloud.Configuration({
    username: 'YOUR_USERNAME',
    password: 'YOUR_PASSWORD',
    apiKey: 'YOUR_API_KEY'
});
const api_instance = new ionoscloud.FirewallRulesApi(config);
// Retrieve firewall rules
api_instance
  .datacentersServersNicsFirewallrulesFindById({
    datacenterId: datacenterId_example,
    serverId: serverId_example,
    nicId: nicId_example,
    firewallruleId: firewallruleId_example,
    pretty: true,
    depth: 56,
    xContractNumber: 56, 
        options: {}
  })
  .then((response) => console.log(response.data))
  .catch((error) => console.log(error.response.data));
```

### Parameters

| Name                | Type        | Description                                                                                                                                                                                                                                                                                                                                                                                                                                   | Notes                              |
| ------------------- | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
| **datacenterId**    | **string**  | The unique ID of the data center.                                                                                                                                                                                                                                                                                                                                                                                                             | \[default to undefined]            |
| **serverId**        | **string**  | The unique ID of the server.                                                                                                                                                                                                                                                                                                                                                                                                                  | \[default to undefined]            |
| **nicId**           | **string**  | The unique ID of the NIC.                                                                                                                                                                                                                                                                                                                                                                                                                     | \[default to undefined]            |
| **firewallruleId**  | **string**  | The unique ID of the firewall rule.                                                                                                                                                                                                                                                                                                                                                                                                           | \[default to undefined]            |
| **pretty**          | **boolean** | Controls whether the response is pretty-printed (with indentations and new lines).                                                                                                                                                                                                                                                                                                                                                            | \[optional]\[default to true]      |
| **depth**           | **number**  | 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\&#39;s children are included. - depth=... and so on | \[optional]\[default to 0]         |
| **xContractNumber** | **number**  | Users with multiple contracts must provide the contract number, for which all API requests are to be executed.                                                                                                                                                                                                                                                                                                                                | \[optional]\[default to undefined] |

### Return type

[**FirewallRule**](/nodejs-sdk/models/firewallrule.md)

### Authorization

Basic Authentication, Token Authentication

### HTTP request headers

* **Content-Type**: Not defined
* **Accept**: application/json

## datacentersServersNicsFirewallrulesGet

> datacentersServersNicsFirewallrulesGet(datacenterId, serverId, nicId, opts)

List firewall rules

List all firewall rules for the specified NIC.

### Examples

```javascript
const ionoscloud = require('@ionos-cloud/sdk-nodejs');
// setup authorization
const config = new ionoscloud.Configuration({
    username: 'YOUR_USERNAME',
    password: 'YOUR_PASSWORD',
    apiKey: 'YOUR_API_KEY'
});
const api_instance = new ionoscloud.FirewallRulesApi(config);
var filterMap = new Map()
filterMap.set("<property_name>", "<property_value>")
// List firewall rules
api_instance
  .datacentersServersNicsFirewallrulesGet({
    datacenterId: datacenterId_example,
    serverId: serverId_example,
    nicId: nicId_example,
    pretty: true,
    depth: 56,
    xContractNumber: 56,
    offset: 56,
    limit: 56, 
    orderBy: "<property_name>"
    maxResults: 2,
    filters: filterMap
    options: {}
  })
  .then((response) => console.log(response.data))
  .catch((error) => console.log(error.response.data));
```

### Parameters

| Name                | Type        | Description                                                                                                                                                                                                                                                                                                                                                                                                                                   | Notes                              |
| ------------------- | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
| **datacenterId**    | **string**  | The unique ID of the data center.                                                                                                                                                                                                                                                                                                                                                                                                             | \[default to undefined]            |
| **serverId**        | **string**  | The unique ID of the server.                                                                                                                                                                                                                                                                                                                                                                                                                  | \[default to undefined]            |
| **nicId**           | **string**  | The unique ID of the NIC.                                                                                                                                                                                                                                                                                                                                                                                                                     | \[default to undefined]            |
| **pretty**          | **boolean** | Controls whether the response is pretty-printed (with indentations and new lines).                                                                                                                                                                                                                                                                                                                                                            | \[optional]\[default to true]      |
| **depth**           | **number**  | 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\&#39;s children are included. - depth=... and so on | \[optional]\[default to 0]         |
| **xContractNumber** | **number**  | Users with multiple contracts must provide the contract number, for which all API requests are to be executed.                                                                                                                                                                                                                                                                                                                                | \[optional]\[default to undefined] |
| **offset**          | **number**  | The first element (from the complete list of the elements) to include in the response (used together with \<b>\<i>limit\</i>\</b> for pagination).                                                                                                                                                                                                                                                                                            | \[optional]\[default to 0]         |
| **limit**           | **number**  | The maximum number of elements to return (use together with offset for pagination).                                                                                                                                                                                                                                                                                                                                                           | \[optional]\[default to 1000]      |

### Return type

[**FirewallRules**](/nodejs-sdk/models/firewallrules.md)

### Authorization

Basic Authentication, Token Authentication

### HTTP request headers

* **Content-Type**: Not defined
* **Accept**: application/json

## datacentersServersNicsFirewallrulesPatch

> datacentersServersNicsFirewallrulesPatch(datacenterId, serverId, nicId, firewallruleId, firewallrule, opts)

Partially modify firewall rules

Update the properties of the specified firewall rule.

### Examples

```javascript
const ionoscloud = require('@ionos-cloud/sdk-nodejs');
// setup authorization
const config = new ionoscloud.Configuration({
    username: 'YOUR_USERNAME',
    password: 'YOUR_PASSWORD',
    apiKey: 'YOUR_API_KEY'
});
const api_instance = new ionoscloud.FirewallRulesApi(config);
// Partially modify firewall rules
api_instance
  .datacentersServersNicsFirewallrulesPatch({
    datacenterId: datacenterId_example,
    serverId: serverId_example,
    nicId: nicId_example,
    firewallruleId: firewallruleId_example,
    firewallrule: firewallrule_example,
    pretty: true,
    depth: 56,
    xContractNumber: 56, 
        options: {}
  })
  .then((response) => console.log(response.data))
  .catch((error) => console.log(error.response.data));
```

### Parameters

| Name                | Type                                                                       | Description                                                                                                                                                                                                                                                                                                                                                                                                                                   | Notes                              |
| ------------------- | -------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
| **datacenterId**    | **string**                                                                 | The unique ID of the data center.                                                                                                                                                                                                                                                                                                                                                                                                             | \[default to undefined]            |
| **serverId**        | **string**                                                                 | The unique ID of the server.                                                                                                                                                                                                                                                                                                                                                                                                                  | \[default to undefined]            |
| **nicId**           | **string**                                                                 | The unique ID of the NIC.                                                                                                                                                                                                                                                                                                                                                                                                                     | \[default to undefined]            |
| **firewallruleId**  | **string**                                                                 | The unique ID of the firewall rule.                                                                                                                                                                                                                                                                                                                                                                                                           | \[default to undefined]            |
| **firewallrule**    | [**FirewallruleProperties**](/nodejs-sdk/models/firewallruleproperties.md) | The properties of the firewall rule to be updated.                                                                                                                                                                                                                                                                                                                                                                                            |                                    |
| **pretty**          | **boolean**                                                                | Controls whether the response is pretty-printed (with indentations and new lines).                                                                                                                                                                                                                                                                                                                                                            | \[optional]\[default to true]      |
| **depth**           | **number**                                                                 | 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\&#39;s children are included. - depth=... and so on | \[optional]\[default to 0]         |
| **xContractNumber** | **number**                                                                 | Users with multiple contracts must provide the contract number, for which all API requests are to be executed.                                                                                                                                                                                                                                                                                                                                | \[optional]\[default to undefined] |

### Return type

[**FirewallRule**](/nodejs-sdk/models/firewallrule.md)

### Authorization

Basic Authentication, Token Authentication

### HTTP request headers

* **Content-Type**: application/json
* **Accept**: application/json

## datacentersServersNicsFirewallrulesPost

> datacentersServersNicsFirewallrulesPost(datacenterId, serverId, nicId, firewallrule, opts)

Create a Firewall Rule

Creates a firewall rule for the specified NIC.

### Examples

```javascript
const ionoscloud = require('@ionos-cloud/sdk-nodejs');
// setup authorization
const config = new ionoscloud.Configuration({
    username: 'YOUR_USERNAME',
    password: 'YOUR_PASSWORD',
    apiKey: 'YOUR_API_KEY'
});
const api_instance = new ionoscloud.FirewallRulesApi(config);
// Create a Firewall Rule
api_instance
  .datacentersServersNicsFirewallrulesPost({
    datacenterId: datacenterId_example,
    serverId: serverId_example,
    nicId: nicId_example,
    firewallrule: firewallrule_example,
    pretty: true,
    depth: 56,
    xContractNumber: 56, 
        options: {}
  })
  .then((response) => console.log(response.data))
  .catch((error) => console.log(error.response.data));
```

### Parameters

| Name                | Type                                                   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                   | Notes                              |
| ------------------- | ------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
| **datacenterId**    | **string**                                             | The unique ID of the data center.                                                                                                                                                                                                                                                                                                                                                                                                             | \[default to undefined]            |
| **serverId**        | **string**                                             | The unique ID of the server.                                                                                                                                                                                                                                                                                                                                                                                                                  | \[default to undefined]            |
| **nicId**           | **string**                                             | The unique ID of the NIC.                                                                                                                                                                                                                                                                                                                                                                                                                     | \[default to undefined]            |
| **firewallrule**    | [**FirewallRule**](/nodejs-sdk/models/firewallrule.md) | The firewall rule to create.                                                                                                                                                                                                                                                                                                                                                                                                                  |                                    |
| **pretty**          | **boolean**                                            | Controls whether the response is pretty-printed (with indentations and new lines).                                                                                                                                                                                                                                                                                                                                                            | \[optional]\[default to true]      |
| **depth**           | **number**                                             | 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\&#39;s children are included. - depth=... and so on | \[optional]\[default to 0]         |
| **xContractNumber** | **number**                                             | Users with multiple contracts must provide the contract number, for which all API requests are to be executed.                                                                                                                                                                                                                                                                                                                                | \[optional]\[default to undefined] |

### Return type

[**FirewallRule**](/nodejs-sdk/models/firewallrule.md)

### Authorization

Basic Authentication, Token Authentication

### HTTP request headers

* **Content-Type**: application/json
* **Accept**: application/json

## datacentersServersNicsFirewallrulesPut

> datacentersServersNicsFirewallrulesPut(datacenterId, serverId, nicId, firewallruleId, firewallrule, opts)

Modify a Firewall Rule

Modifies the properties of the specified firewall rule.

### Examples

```javascript
const ionoscloud = require('@ionos-cloud/sdk-nodejs');
// setup authorization
const config = new ionoscloud.Configuration({
    username: 'YOUR_USERNAME',
    password: 'YOUR_PASSWORD',
    apiKey: 'YOUR_API_KEY'
});
const api_instance = new ionoscloud.FirewallRulesApi(config);
// Modify a Firewall Rule
api_instance
  .datacentersServersNicsFirewallrulesPut({
    datacenterId: datacenterId_example,
    serverId: serverId_example,
    nicId: nicId_example,
    firewallruleId: firewallruleId_example,
    firewallrule: firewallrule_example,
    pretty: true,
    depth: 56,
    xContractNumber: 56, 
        options: {}
  })
  .then((response) => console.log(response.data))
  .catch((error) => console.log(error.response.data));
```

### Parameters

| Name                | Type                                                   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                   | Notes                              |
| ------------------- | ------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- |
| **datacenterId**    | **string**                                             | The unique ID of the data center.                                                                                                                                                                                                                                                                                                                                                                                                             | \[default to undefined]            |
| **serverId**        | **string**                                             | The unique ID of the server.                                                                                                                                                                                                                                                                                                                                                                                                                  | \[default to undefined]            |
| **nicId**           | **string**                                             | The unique ID of the NIC.                                                                                                                                                                                                                                                                                                                                                                                                                     | \[default to undefined]            |
| **firewallruleId**  | **string**                                             | The unique ID of the firewall rule.                                                                                                                                                                                                                                                                                                                                                                                                           | \[default to undefined]            |
| **firewallrule**    | [**FirewallRule**](/nodejs-sdk/models/firewallrule.md) | The modified firewall rule.                                                                                                                                                                                                                                                                                                                                                                                                                   |                                    |
| **pretty**          | **boolean**                                            | Controls whether the response is pretty-printed (with indentations and new lines).                                                                                                                                                                                                                                                                                                                                                            | \[optional]\[default to true]      |
| **depth**           | **number**                                             | 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\&#39;s children are included. - depth=... and so on | \[optional]\[default to 0]         |
| **xContractNumber** | **number**                                             | Users with multiple contracts must provide the contract number, for which all API requests are to be executed.                                                                                                                                                                                                                                                                                                                                | \[optional]\[default to undefined] |

### Return type

[**FirewallRule**](/nodejs-sdk/models/firewallrule.md)

### Authorization

Basic Authentication, Token Authentication

### HTTP request headers

* **Content-Type**: application/json
* **Accept**: application/json


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ionos.com/nodejs-sdk/api/firewallrulesapi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
