Skip to main content
POST
/
events
/
filter
Read Events
curl --request POST \
  --url https://api.example.com/events/filter \
  --header 'Content-Type: application/json' \
  --data '
{
  "filter": {
    "occurred": {
      "since": "2023-11-07T05:31:56Z",
      "until": "2023-11-07T05:31:56Z"
    },
    "event": {
      "prefix": [
        "<string>"
      ],
      "exclude_prefix": [
        "<string>"
      ],
      "name": [
        "<string>"
      ],
      "exclude_name": [
        "<string>"
      ]
    },
    "resource": {
      "id": [
        "<string>"
      ],
      "id_prefix": [
        "<string>"
      ],
      "labels": {},
      "distinct": false
    },
    "related": {
      "id": [
        "<string>"
      ],
      "role": [
        "<string>"
      ],
      "resources_in_roles": [
        [
          "<string>",
          "<string>"
        ]
      ],
      "labels": {}
    },
    "any_resource": {
      "id": [
        "<string>"
      ],
      "id_prefix": [
        "<string>"
      ],
      "labels": {}
    },
    "id": {
      "id": [
        "3c90c3cc-0d44-4b50-8888-8dd25736052a"
      ]
    },
    "text": {
      "query": "<string>"
    },
    "order": "DESC"
  },
  "limit": 50
}
'
import requests

url = "https://api.example.com/events/filter"

payload = {
"filter": {
"occurred": {
"since": "2023-11-07T05:31:56Z",
"until": "2023-11-07T05:31:56Z"
},
"event": {
"prefix": ["<string>"],
"exclude_prefix": ["<string>"],
"name": ["<string>"],
"exclude_name": ["<string>"]
},
"resource": {
"id": ["<string>"],
"id_prefix": ["<string>"],
"labels": {},
"distinct": False
},
"related": {
"id": ["<string>"],
"role": ["<string>"],
"resources_in_roles": [["<string>", "<string>"]],
"labels": {}
},
"any_resource": {
"id": ["<string>"],
"id_prefix": ["<string>"],
"labels": {}
},
"id": { "id": ["3c90c3cc-0d44-4b50-8888-8dd25736052a"] },
"text": { "query": "<string>" },
"order": "DESC"
},
"limit": 50
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
filter: {
occurred: {since: '2023-11-07T05:31:56Z', until: '2023-11-07T05:31:56Z'},
event: {
prefix: ['<string>'],
exclude_prefix: ['<string>'],
name: ['<string>'],
exclude_name: ['<string>']
},
resource: {id: ['<string>'], id_prefix: ['<string>'], labels: {}, distinct: false},
related: {
id: ['<string>'],
role: ['<string>'],
resources_in_roles: [['<string>', '<string>']],
labels: {}
},
any_resource: {id: ['<string>'], id_prefix: ['<string>'], labels: {}},
id: {id: ['3c90c3cc-0d44-4b50-8888-8dd25736052a']},
text: {query: '<string>'},
order: 'DESC'
},
limit: 50
})
};

fetch('https://api.example.com/events/filter', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/events/filter",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'filter' => [
'occurred' => [
'since' => '2023-11-07T05:31:56Z',
'until' => '2023-11-07T05:31:56Z'
],
'event' => [
'prefix' => [
'<string>'
],
'exclude_prefix' => [
'<string>'
],
'name' => [
'<string>'
],
'exclude_name' => [
'<string>'
]
],
'resource' => [
'id' => [
'<string>'
],
'id_prefix' => [
'<string>'
],
'labels' => [

],
'distinct' => false
],
'related' => [
'id' => [
'<string>'
],
'role' => [
'<string>'
],
'resources_in_roles' => [
[
'<string>',
'<string>'
]
],
'labels' => [

]
],
'any_resource' => [
'id' => [
'<string>'
],
'id_prefix' => [
'<string>'
],
'labels' => [

]
],
'id' => [
'id' => [
'3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
],
'text' => [
'query' => '<string>'
],
'order' => 'DESC'
],
'limit' => 50
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.example.com/events/filter"

payload := strings.NewReader("{\n \"filter\": {\n \"occurred\": {\n \"since\": \"2023-11-07T05:31:56Z\",\n \"until\": \"2023-11-07T05:31:56Z\"\n },\n \"event\": {\n \"prefix\": [\n \"<string>\"\n ],\n \"exclude_prefix\": [\n \"<string>\"\n ],\n \"name\": [\n \"<string>\"\n ],\n \"exclude_name\": [\n \"<string>\"\n ]\n },\n \"resource\": {\n \"id\": [\n \"<string>\"\n ],\n \"id_prefix\": [\n \"<string>\"\n ],\n \"labels\": {},\n \"distinct\": false\n },\n \"related\": {\n \"id\": [\n \"<string>\"\n ],\n \"role\": [\n \"<string>\"\n ],\n \"resources_in_roles\": [\n [\n \"<string>\",\n \"<string>\"\n ]\n ],\n \"labels\": {}\n },\n \"any_resource\": {\n \"id\": [\n \"<string>\"\n ],\n \"id_prefix\": [\n \"<string>\"\n ],\n \"labels\": {}\n },\n \"id\": {\n \"id\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n },\n \"text\": {\n \"query\": \"<string>\"\n },\n \"order\": \"DESC\"\n },\n \"limit\": 50\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.example.com/events/filter")
.header("Content-Type", "application/json")
.body("{\n \"filter\": {\n \"occurred\": {\n \"since\": \"2023-11-07T05:31:56Z\",\n \"until\": \"2023-11-07T05:31:56Z\"\n },\n \"event\": {\n \"prefix\": [\n \"<string>\"\n ],\n \"exclude_prefix\": [\n \"<string>\"\n ],\n \"name\": [\n \"<string>\"\n ],\n \"exclude_name\": [\n \"<string>\"\n ]\n },\n \"resource\": {\n \"id\": [\n \"<string>\"\n ],\n \"id_prefix\": [\n \"<string>\"\n ],\n \"labels\": {},\n \"distinct\": false\n },\n \"related\": {\n \"id\": [\n \"<string>\"\n ],\n \"role\": [\n \"<string>\"\n ],\n \"resources_in_roles\": [\n [\n \"<string>\",\n \"<string>\"\n ]\n ],\n \"labels\": {}\n },\n \"any_resource\": {\n \"id\": [\n \"<string>\"\n ],\n \"id_prefix\": [\n \"<string>\"\n ],\n \"labels\": {}\n },\n \"id\": {\n \"id\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n },\n \"text\": {\n \"query\": \"<string>\"\n },\n \"order\": \"DESC\"\n },\n \"limit\": 50\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.example.com/events/filter")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"filter\": {\n \"occurred\": {\n \"since\": \"2023-11-07T05:31:56Z\",\n \"until\": \"2023-11-07T05:31:56Z\"\n },\n \"event\": {\n \"prefix\": [\n \"<string>\"\n ],\n \"exclude_prefix\": [\n \"<string>\"\n ],\n \"name\": [\n \"<string>\"\n ],\n \"exclude_name\": [\n \"<string>\"\n ]\n },\n \"resource\": {\n \"id\": [\n \"<string>\"\n ],\n \"id_prefix\": [\n \"<string>\"\n ],\n \"labels\": {},\n \"distinct\": false\n },\n \"related\": {\n \"id\": [\n \"<string>\"\n ],\n \"role\": [\n \"<string>\"\n ],\n \"resources_in_roles\": [\n [\n \"<string>\",\n \"<string>\"\n ]\n ],\n \"labels\": {}\n },\n \"any_resource\": {\n \"id\": [\n \"<string>\"\n ],\n \"id_prefix\": [\n \"<string>\"\n ],\n \"labels\": {}\n },\n \"id\": {\n \"id\": [\n \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n ]\n },\n \"text\": {\n \"query\": \"<string>\"\n },\n \"order\": \"DESC\"\n },\n \"limit\": 50\n}"

response = http.request(request)
puts response.read_body
{
  "events": [
    {
      "occurred": "2023-11-07T05:31:56Z",
      "event": "<string>",
      "resource": {},
      "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "related": [
        {}
      ],
      "payload": {},
      "follows": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "received": "2023-11-07T05:31:56Z"
    }
  ],
  "total": 123,
  "next_page": "<string>"
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}

Headers

x-prefect-api-version
string

Body

application/json
filter
EventFilter · object | null

Additional optional filter criteria to narrow down the set of Events

limit
integer
default:50

The number of events to return with each page

Required range: 0 <= x <= 50

Response

Successful Response

A single page of events returned from the API, with an optional link to the next page of results

events
ReceivedEvent · object[]
required

The Events matching the query

total
integer
required

The total number of matching Events

next_page
string<uri> | null
required

The URL for the next page of results, if there are more

Minimum string length: 1