Create list items
rules.lists.items.create(strlist_id, ItemCreateParams**kwargs) -> ItemCreateResponse
POST/accounts/{account_id}/rules/lists/{list_id}/items
Appends new items to the list.
This operation is asynchronous. To get current the operation status, invoke the Get bulk operation status endpoint with the returned operation_id.
There is a limit of 1 pending bulk operation per account. If an outstanding bulk operation is in progress, the request will be rejected.
Security
API Token
The preferred authorization scheme for interacting with the Cloudflare API. Create a token.
Example:
API Email + API Key
The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.
Example:
The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.
Example:
Accepted Permissions (at least one required)
Parameters
Create list items
import os
from cloudflare import Cloudflare
client = Cloudflare(
api_token=os.environ.get("CLOUDFLARE_API_TOKEN"), # This is the default and can be omitted
)
item = client.rules.lists.items.create(
list_id="2c0fc9fa937b11eaa1b71c4d701ab86e",
account_id="023e105f4ecef8ad9ca31a8372d0c353",
body=[{
"ip": "10.0.0.1"
}],
)
print(item.operation_id){
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"operation_id": "4da8780eeb215e6cb7f48dd981c4ea02"
},
"success": true
}Returns Examples
{
"errors": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"messages": [
{
"code": 1000,
"message": "message",
"documentation_url": "documentation_url",
"source": {
"pointer": "pointer"
}
}
],
"result": {
"operation_id": "4da8780eeb215e6cb7f48dd981c4ea02"
},
"success": true
}