Skip to content

filter example generates error when used exactly as shown #26491

@ryderdain

Description

@ryderdain

Existing documentation URL(s)

What changes are you suggesting?

The second "filter" example here, given as

# Filter when the status code returned from Cloudflare is either 200 or 201:
"filter": "{\"where\":{\"and\":[{\"key\":\"EdgeResponseStatus\",\"operator\":\"in\",\"value\":\"200,201\"}]}}"

will throw an error when given as-is:

$ curl "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/logpush/edge/jobs"   --request POST   --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN"   --json '{
    "fields": "ClientIP,ClientRequestHost,ClientRequestMethod,ClientRequestURI,ClientSSLProtocol,ClientSSLCipher,OriginResponseBytes,OriginResponseStatus",
    "sample": 100,
    "filter": "{\"where\":{\"and\":[{\"key\":\"EdgeResponseStatus\",\"operator\":\"in\",\"value\":\"200,201\"}]}}",
    "kind": "instant-logs"
  }'
{"errors":[{"code":1004,"message":"creating a new instant logs job is not allowed: bad predicate: failed to decode value \"\\\"200,201\\\"\", supported kinds: []uint64"}],"messages":[],"result":null,"success":false}

Suggested edit:

# Filter when the status code returned from Cloudflare is either 200 or 201:
"filter": "{\"where\":{\"and\":[{\"key\":\"EdgeResponseStatus\",\"operator\":\"in\",\"value\":[200,201]}]}}"

Additional information

No response

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions