Creating an IP Address Group
Function
This API is used to create an IP address group.
URI
POST /v1/{project_id}/waf/ip-groups
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Project ID |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| enterprise_project_id | No | String | Enterprise project ID. |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | User token. It can be obtained by calling the IAM API (value of X-Subject-Token in the response header). |
| Content-Type | Yes | String | Content type. |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| name | Yes | String | Address group name |
| ips | Yes | String | IP addresses or IP address ranges are separated by commas (,). |
| description | No | String | Address group description |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| id | String | ID of the IP address group |
| name | String | IP address group name |
| ips | String | Address group IP addresses (IP addresses or IP address ranges are separated by commas (,). |
| size | Integer | Length of the IP address group |
| rules | Array of RuleInfo objects | List of rules that use the IP address group |
| description | String | Address group description |
| timestamp | Long | Timestamp |
| Parameter | Type | Description |
|---|---|---|
| rule_id | String | Rule ID |
| rule_name | String | Rule name |
| policy_id | String | Policy ID |
| policy_name | String | Policy Name |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code |
| error_msg | String | Error message |
Status code: 401
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code |
| error_msg | String | Error message |
Status code: 500
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Error code |
| error_msg | String | Error message |
Example Requests
The following example shows how to create an address group in a project. The project ID is specified by project_id. IP address group name: group3. IP address: xx.xx.xx.xx. Address group description: demo.
POST https://{Endpoint}/v1/{project_id}/waf/ip-groups?enterprise_project_id=0
{
"name" : "group3",
"ips" : "xx.xx.xx.xx",
"description" : "demo"
} Example Responses
Status code: 200
Request succeeded.
{
"id" : "c36e896b18ee486a81026fce8e69fb1a",
"ips" : "xx.xx.xx.xx",
"name" : "group3",
"rules" : [ ],
"size" : 1,
"timestamp" : 1666747418345,
"description" : "demo"
} Status Codes
| Status Code | Description |
|---|---|
| 200 | Request succeeded. |
| 400 | Request failed. |
| 401 | The token does not have required permissions. |
| 500 | Internal server error. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.