Is it possible to subscribe to the events Rest-API-endpoint?

In the linked thread I read that it is possible to subscribe to the events endpoint of the REST API, which I think means that I get a continuous stream of changes as result: Possibility to log “recent changes” to file or log?

The documentation talks about a subscription as well, but it seems to be in a different context.

I especially want to avoid this situation talked in the documentation:

There is a limit to the number of events buffered, so if the rate of events is high or the time between polling calls is long some events might be missed.

I’ve tried opening a stream with Python, but it returns instantly instead:

import requests

url = "http://localhost:8384/rest/events"
headers = {"X-API-Key": <API-KEY-STRING>}

with requests.get(url, headers=headers, stream=True) as r:
    for line in r.iter_lines():
        if line:
            print(line.decode("utf-8"))

Is it really possible to subscribe to the end point, and if so, how?

The subscription is internal; you use it by using the since parameter as described. It is not a push/webhook type mechanism, which would anyway suffer from similar limitations.

1 Like

@calmh Thank you for the answer!

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