Using API to create/update event definitions

I’m trying to write an ansible playbook that configures our alerts in graylog.
The design I’m trying to implement is like this:

  1. Each event definition is a seperate file with the json body
  2. For each file, GET /api/events/definitions searching the “title”
    3a. If a definition is found in (2) then call PUT to update the current definition
    3b. If no definition is found in (2) then call POST to create the definition

The problem I’m having is with (2). I’ve been trying to use the query parameter, searching for the “title” of the definition but I can’t get exact searching to work.

As you can see in the screenshot, I’m trying to search for exactly title: “[Sandbox] Registry errors 2” but the API finds a definition with title: “[Sandbox] Registry errors”

Is there a syntax to find a definition with exactly some title?

Seems like I found the solution… no space after the field I’m searching on …

title:"[Sandbox] Registry errors" seems to get me the exact search I was looking for. Adding a space after the colon breaks it.

1 Like

Mark it as a solution for future searchers! :slight_smile:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.