Updating a Blacklist or Whitelist¶
Function¶
This API is used to update a blacklist or whitelist.
URI¶
PUT /v1/{project_id}/black-white-list/{list_id}
Parameter | Mandatory | Type | Description |
---|---|---|---|
project_id | Yes | String | Project ID, which can be obtained by calling an API or from the console. For details, see Obtaining a Project ID. |
list_id | Yes | String | Blacklist or whitelist ID, which can be obtained through the API for querying the blacklist or whitelist. Find the value in data.records.list_id (The period [.] is used to separate different levels of objects). |
Parameter | Mandatory | Type | Description |
---|---|---|---|
enterprise_project_id | No | String | Enterprise project ID, which is the ID of a project planned based on organizations. You can obtain the enterprise project ID by referring to Obtaining an Enterprise Project ID. If the enterprise project function is not enabled, the value is 0. |
fw_instance_id | No | String | Firewall ID, which can be obtained by referring to Obtaining a Firewall ID. |
Request Parameters¶
Parameter | Mandatory | Type | Description |
---|---|---|---|
X-Auth-Token | Yes | String | User token. You can obtain the token by referring to Obtaining a User Token. |
Content-Type | Yes | String | Content type. It can only be set to application/json. |
Parameter | Mandatory | Type | Description |
---|---|---|---|
direction | No | Integer | Address direction: 0 (source), 1 (destination). |
address_type | No | Integer | Address type: 0 (IPv4), 1 (IPv6). |
address | Yes | String | IP address |
protocol | No | Integer | Protocol type: 6 (TCP), 17 (UDP), 1 (ICMP), 58 (ICMPv6), or -1 (any). |
port | No | String | Port |
description | No | String | Description. |
Response Parameters¶
Status code: 200
Parameter | Type | Description |
---|---|---|
data | BlackWhiteListId object | Response to the request for updating the blacklist/whitelist. |
Parameter | Type | Description |
---|---|---|
id | String | Blacklist/Whitelist ID. |
name | String | Blacklist/Whitelist name. |
Status code: 400
Parameter | Type | Description |
---|---|---|
error_code | String | Error code. |
error_msg | String | Error description. |
Example Requests¶
Update the whitelist of object cfebd347-b655-4b84-b938-3c54317599b2 of project 9d80d070b6d44942af73c9c3d38e0429. Direction: source address; IP address: 1.1.1.1; protocol type: TCP; port number: 1.
https://{Endpoint}/v1/9d80d070b6d44942af73c9c3d38e0429/black-white-list/9d80d070b6d44942af73c9c3d38e042b
{
"direction" : 0,
"address" : "1.1.1.1",
"protocol" : 6,
"port" : "1",
"address_type" : 0
}
Example Responses¶
Status code: 200
Response to the request for updating a blacklist or whitelist.
{
"data" : {
"id" : "5d37afe6-c5b4-400d-8ff3-a8d6396d7ace",
"name" : "10.1.1.10"
}
}
Status code: 400
Bad Request
{
"error_code" : "CFW.00200005",
"error_msg" : "Object not found."
}
Status Codes¶
Status Code | Description |
---|---|
200 | Response to the request for updating a blacklist or whitelist. |
400 | Bad Request |
401 | Unauthorized |
403 | Forbidden |
404 | Not Found |
500 | Internal Server Error |
Error Codes¶
See Error Codes.