Cloudflare.List (Cloudflare v0.5.0)

Copy Markdown View Source

Lists

Create a list

POST /accounts/{account_id}/rules/lists

Creates a new list of the specified kind.

Responses

200 Create a list response.

Data is at body["result"]

null
4XX Create a list response failure.
{
  "errors": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "messages": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "result": {},
  "success": "*boolean*"
}

Get lists

GET /accounts/{account_id}/rules/lists

Fetches all lists in the account.

Responses

200 Get lists response.

Data is at body["result"]

null
4XX Get lists response failure.
{
  "errors": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "messages": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "result": {},
  "success": "*boolean*"
}

Get bulk operation status

GET /accounts/{account_id}/rules/lists/bulk_operations/{operation_id}

Gets the current status of an asynchronous operation on a list.

The status property can have one of the following values: pending, running, completed, or failed. If the status is failed, the error property will contain a message describing the error.

Responses

200 Get bulk operation status response.

Data is at body["result"]

null
4XX Get bulk operation status response failure.
{
  "errors": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "messages": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "result": {},
  "success": "*boolean*"
}

Update a list

PUT /accounts/{account_id}/rules/lists/{list_id}

Updates the description of a list.

Responses

200 Update a list response.

Data is at body["result"]

null
4XX Update a list response failure.
{
  "errors": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "messages": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "result": {},
  "success": "*boolean*"
}

Get a list

GET /accounts/{account_id}/rules/lists/{list_id}

Fetches the details of a list.

Responses

200 Get a list response.

Data is at body["result"]

null
4XX Get a list response failure.
{
  "errors": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "messages": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "result": {},
  "success": "*boolean*"
}

Delete a list

DELETE /accounts/{account_id}/rules/lists/{list_id}

Deletes a specific list and all its items.

Responses

200 Delete a list response.

Data is at body["result"]

null
4XX Delete a list response failure.
{
  "errors": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "messages": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "result": {},
  "success": "*boolean*"
}

Update all list items

PUT /accounts/{account_id}/rules/lists/{list_id}/items

Removes all existing items from the list and adds the provided 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.

Responses

200 Update all list items response.

Data is at body["result"]

null
4XX Update all list items response failure.
{
  "errors": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "messages": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "result": {},
  "success": "*boolean*"
}

Create list items

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.

Responses

200 Create list items response.

Data is at body["result"]

null
4XX Create list items response failure.
{
  "errors": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "messages": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "result": {},
  "success": "*boolean*"
}

Get list items

GET /accounts/{account_id}/rules/lists/{list_id}/items

Fetches all the items in the list.

Responses

200 Get list items response.

Data is at body["result"]

null
4XX Get list items response failure.
{
  "errors": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "messages": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "result": {},
  "result_info": {
    "cursors": {
      "after": "*string*",
      "before": "*string*"
    }
  },
  "success": "*boolean*"
}

Delete list items

DELETE /accounts/{account_id}/rules/lists/{list_id}/items

Removes one or more items from a 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.

Responses

200 Delete list items response.

Data is at body["result"]

null
4XX Delete list items response failure.
{
  "errors": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "messages": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "result": {},
  "success": "*boolean*"
}

Get a list item

GET /accounts/{account_id}/rules/lists/{list_id}/items/{item_id}

Fetches a list item in the list.

Responses

200 Get a list item response.

Data is at body["result"]

null
4XX Get a list item response failure.
{
  "errors": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "messages": [
    {
      "code": "*integer*",
      "message": "*string*"
    }
  ],
  "result": {},
  "success": "*boolean*"
}

Summary

Functions

client(opts \\ [])

create(body, opts \\ [])

@spec create(
  body :: Restlax.Resource.action_body(),
  opts :: Restlax.Resource.action_options()
) ::
  {:ok, map()} | {:error, term()}

create!(body, opts \\ [])

@spec create!(
  body :: Restlax.Resource.action_body(),
  opts :: Restlax.Resource.action_options()
) ::
  map() | no_return()

create_items(list_id, body, opts \\ [])

Creates new items in a list (appends).

delete(id, opts \\ [])

@spec delete(id :: term(), opts :: Restlax.Resource.action_options()) ::
  {:ok, map()} | {:error, term()}

delete!(id, opts \\ [])

@spec delete!(id :: term(), opts :: Restlax.Resource.action_options()) ::
  map() | no_return()

delete_items(list_id, body, opts \\ [])

Deletes items from a list (by IDs in the body).

index(opts \\ [])

@spec index(opts :: Restlax.Resource.action_options()) ::
  {:ok, map()} | {:error, term()}

index!(opts \\ [])

@spec index!(opts :: Restlax.Resource.action_options()) :: map() | no_return()

items(list_id, opts \\ [])

Gets all items in a list.

path_for(id, opts \\ [])

@spec path_for(term(), [{:action, String.t()}]) :: String.t()

replace_items(list_id, body, opts \\ [])

Replaces all items in a list.

show(id, opts \\ [])

@spec show(id :: term(), opts :: Restlax.Resource.action_options()) ::
  {:ok, map()} | {:error, term()}

show!(id, opts \\ [])

@spec show!(id :: term(), opts :: Restlax.Resource.action_options()) ::
  map() | no_return()

update(id, body, opts \\ [])

@spec update(
  id :: term(),
  body :: Restlax.Resource.action_body(),
  opts :: Restlax.Resource.action_options()
) :: {:ok, map()} | {:error, term()}

update!(id, body, opts \\ [])

@spec update!(
  id :: term(),
  body :: Restlax.Resource.action_body(),
  opts :: Restlax.Resource.action_options()
) :: map() | no_return()