You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/waf/tools/lists/lists-api/endpoints.mdx
+40-19Lines changed: 40 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,44 +3,65 @@ title: Endpoints
3
3
pcx_content_type: reference
4
4
sidebar:
5
5
order: 2
6
-
7
6
---
8
7
9
8
To invoke a [Lists API](/api/resources/rules/subresources/lists/) operation, append the endpoint to the Cloudflare API base URL:
10
9
11
10
`https://api.cloudflare.com/client/v4/`
12
11
13
-
For authentication instructions, refer to [Cloudflare's API: Getting Started](/fundamentals/api/get-started/).
12
+
For authentication instructions, refer to [Cloudflare's API: Get started](/fundamentals/api/get-started/).
14
13
15
14
For help with making API calls and paginating results, refer to [Make API calls](/fundamentals/api/how-to/make-api-calls/).
16
15
17
16
:::note
18
17
19
-
20
18
The Lists API endpoints require a value for `{account_id}`.
21
19
22
20
To retrieve a list of accounts to which you have access, use the [List Accounts](/api/resources/accounts/methods/list/) operation and note the IDs of the accounts you want to manage.
23
21
24
-
25
22
:::
26
23
27
24
The Lists API supports the operations outlined below. Visit the associated links for examples.
28
25
26
+
## Manage lists
27
+
28
+
### Create a list
29
29
30
+
-**Operation**: [Create a list](/api/resources/rules/subresources/lists/methods/create/)
31
+
-**Method and endpoint**: `POST accounts/{account_id}/rules/lists`
32
+
-**Notes**: Creates an empty list.
30
33
31
-
##Manage lists
34
+
### Get lists
32
35
33
-
| Operation | Endpoint | Notes |
34
-
| --- | --- | --- |
35
-
|[Create a list](/api/resources/rules/subresources/lists/methods/create/)|`POST accounts/{account_id}/rules/lists`| Creates an empty list |
36
-
|[Get lists](/api/resources/rules/subresources/lists/methods/list/)|`GET accounts/{account_id}/rules/lists`| Fetch all lists for the account. (This request does not fetch the items in the lists.) |
37
-
|[Get a list](/api/resources/rules/subresources/lists/methods/get/)|`GET accounts/{account_id}/rules/lists/{list_id}`| Fetches a list by its ID. (This request does not display the items in the list.) |
38
-
|[Update a list](/api/resources/rules/subresources/lists/methods/update/)|`PUT accounts/{account_id}/rules/lists/{list_id}`| Updates the `description` of a list. You cannot edit the `name` or `kind`, and you cannot update items in a list. To update an item in a list, use the [Update all list items](/api/resources/rules/subresources/lists/subresources/items/methods/update/) operation. |
39
-
|[Delete a list](/api/resources/rules/subresources/lists/methods/delete/)|`DELETE accounts/{account_id}/rules/lists/{list_id}`| Deletes the list, but only when no filters reference it. |
-**Method and endpoint**: `GET accounts/{account_id}/rules/lists`
38
+
-**Notes**:
39
+
- Fetches all lists for the account.
40
+
- This request does not fetch the items in the lists.
40
41
41
-
##Manage items in a list
42
+
### Get a list
42
43
44
+
-**Operation**: [Get a list](/api/resources/rules/subresources/lists/methods/get/)
45
+
-**Method and endpoint**: `GET accounts/{account_id}/rules/lists/{list_id}`
46
+
-**Notes**:
47
+
- Fetches a list by its ID.
48
+
- This request does not display the items in the list.
49
+
50
+
### Update a list
51
+
52
+
-**Operation**: [Update a list](/api/resources/rules/subresources/lists/methods/update/)
53
+
-**Method and endpoint**: `PUT accounts/{account_id}/rules/lists/{list_id}`
54
+
-**Notes**:
55
+
- Updates the `description` of a list.
56
+
- You cannot edit the `name` or `kind`, and you cannot update items in a list. To update an item in a list, use the [Update all list items](#update-all-list-items) operation.
43
57
58
+
### Delete a list
59
+
60
+
-**Operation**: [Delete a list](/api/resources/rules/subresources/lists/methods/delete/)
61
+
-**Method and endpoint**: `DELETE accounts/{account_id}/rules/lists/{list_id}`
62
+
-**Notes**: Deletes the list, but only when no [filters](/firewall/api/cf-filters/) reference it.
63
+
64
+
## Manage items in a list
44
65
45
66
Nearly all the operations for managing items in a list are asynchronous. When you add or delete a large amount of items to or from a list, there may be a delay before the bulk operation is complete.
46
67
@@ -51,7 +72,7 @@ When you make requests to a list while a bulk operation on that list is in progr
51
72
### Get list items
52
73
53
74
-**Operation**: [Get list items](/api/resources/rules/subresources/lists/subresources/items/methods/list/)
54
-
-**Method and endpoints**: `GET accounts/{account_id}/rules/lists/{list_id}/items[?search={query}]`
75
+
-**Method and endpoint**: `GET accounts/{account_id}/rules/lists/{list_id}/items[?search={query}]`
55
76
-**Notes**:
56
77
- Fetches items in a list (all items, by default).
57
78
- Items are sorted in ascending order.
@@ -61,13 +82,13 @@ When you make requests to a list while a bulk operation on that list is in progr
61
82
### Get a list item
62
83
63
84
-**Operation**: [Get a list item](/api/resources/rules/subresources/lists/subresources/items/methods/get/)
64
-
-**Method and endpoints**: `GET accounts/{account_id}/rules/lists/{list_id}/items/{item_id}`
85
+
-**Method and endpoint**: `GET accounts/{account_id}/rules/lists/{list_id}/items/{item_id}`
65
86
-**Notes**: Fetches an item from a list by ID
66
87
67
88
### Create list items
68
89
69
90
-**Operation**: [Create list items](/api/resources/rules/subresources/lists/subresources/items/methods/create/)
70
-
-**Method and endpoints**: `POST accounts/{account_id}/rules/lists/{list_id}/items`
91
+
-**Method and endpoint**: `POST accounts/{account_id}/rules/lists/{list_id}/items`
71
92
-**Notes**:
72
93
- Appends a new item or items to a list.
73
94
- Replaces entries that already exist in the list, does not delete any items.
@@ -77,7 +98,7 @@ When you make requests to a list while a bulk operation on that list is in progr
77
98
### Update all list items
78
99
79
100
-**Operation**: [Update all list items](/api/resources/rules/subresources/lists/subresources/items/methods/update/)
80
-
-**Method and endpoints**: `PUT accounts/{account_id}/rules/lists/{list_id}/items`
101
+
-**Method and endpoint**: `PUT accounts/{account_id}/rules/lists/{list_id}/items`
81
102
-**Notes**:
82
103
- Deletes all current items in the list and replaces them with `items`.
83
104
- When `items` is empty, deletes **all** items in the list.
@@ -86,7 +107,7 @@ When you make requests to a list while a bulk operation on that list is in progr
86
107
### Delete list items
87
108
88
109
-**Operation**: [Delete list items](/api/resources/rules/subresources/lists/subresources/items/methods/delete/)
89
-
-**Method and endpoints**: `DELETE accounts/{account_id}/rules/lists/{list_id}/items`
110
+
-**Method and endpoint**: `DELETE accounts/{account_id}/rules/lists/{list_id}/items`
0 commit comments