const url = 'https://example.com/api/v0/serve-multi';const options = { method: 'POST', headers: {'X-Tenzir-Token': '<X-Tenzir-Token>', 'Content-Type': 'application/json'}, body: '{"requests":[{"serve_id":"query-1","continuation_token":null},{"serve_id":"query-2","continuation_token":"340ce2j"}],"max_events":1024,"min_events":1,"timeout":"5s","schema":"exact"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/api/v0/serve-multi \ --header 'Content-Type: application/json' \ --header 'X-Tenzir-Token: <X-Tenzir-Token>' \ --data '{ "requests": [ { "serve_id": "query-1", "continuation_token": null }, { "serve_id": "query-2", "continuation_token": "340ce2j" } ], "max_events": 1024, "min_events": 1, "timeout": "5s", "schema": "exact" }'Reads events from multiple existing pipeline output streams. By default, the endpoint uses long polling (timeout: 5s) and returns as soon as at least one event is available (min_events: 1).
Authorizations
Section titled “Authorizations ”Request Body required
Section titled “Request Body required ”Pipeline output batch request.
object
object
The output stream identifier returned when the pipeline was launched.
The continuation token from the previous response for this output stream. Omit this field for the initial request.
The maximum number of events to return across all requested output streams. The limit is split evenly across streams and rounded up when necessary.
The minimum number of events to wait for across all requested output streams before returning. The limit is split evenly across streams and rounded up when necessary.
The maximum time to spend on the request. Reaching the timeout returns the available events and is not an error. The timeout must not be greater than 10 seconds.
The schema representation to include in each response. Use exact for a representation that matches Tenzir’s type system exactly, and never to omit schema definitions.
Example
{ "requests": [ { "serve_id": "query-1", "continuation_token": null }, { "serve_id": "query-2", "continuation_token": "340ce2j" } ], "max_events": 1024, "min_events": 1, "timeout": "5s", "schema": "exact"}Responses
Section titled “ Responses ”The response contains one entry for each requested output stream.
object
A response keyed by output stream identifier.
object
The token to use when reading the next batch. The value is null when the pipeline reached a terminal state.
The pipeline state at the time of the request.
The schemas for the returned events. This field is omitted when the request sets schema to never.
object
The unique schema identifier.
The schema definition in JSON format.
The returned events.
object
The unique schema identifier.
The event data in JSON format.
object
Example
{ "query-1": { "next_continuation_token": "340ce2j", "state": "running", "schemas": [], "events": [ { "schema_id": "c631d301e4b18f4", "data": { "timestamp": "2023-04-26T12:00:00Z", "schema": "zeek.conn", "events": 50 } } ] }, "query-2": { "next_continuation_token": null, "state": "completed", "schemas": [], "events": [] }}The request body is invalid.
object
The error message.
Example
{ "error": "Invalid arguments"}