A new event may be pushed through the POST /log/
endpoint.
The request body is expected to contain either one or a series of objects in the following binary format:
1. labelLength Uint16 LE
2. payloadLength Uint32 LE
3. [label utf-8] // Not empty if labelLength > 0
4. payload utf-8
The document {"version":"v","version-previous":"vp","time":"t"}
will be returned in case of success where v
is the version the new event was written at, vp
the version of the event it was appended on and t
the time the event was recorded at. If multiple events have been appended then "version-first":vf
will be added to the returned document where vf
is the version of the first appended event while v
is the version of the latest appended event.
A new event may be pushed transactionally following the Optimistic Concurrency Control (OCC) principle through the POST /log/:assumedVersion
endpoint where assumedVersion
is the version of the current projection.
In case of a mismatch between the provided and actual versions 400 ErrMismatchingVersions
will be returned.
The request body is expected to be similar to the non-transactional push endpoint. In case of success the returned result document will be similar to the one of the non-transactional push endpoint.
The GET /version
endpoint returns {"version":"x"}
where x
is a hexadecimal version number representing the current database version.
The GET /version/initial
endpoint returns {"version-initial":"x"}
where x
is a hexadecimal version number representing the initial database version (it's the version the very first event was recorded at).
The GET /log/:version
endpoint returns an array of {"time":"t","version":"v","version-previous":"vp","version-next":"vn","label":"l","payload":p}
event objects starting at the given version where t
is the time the event was recorded at, v
is the version the event was recorded at, vp
is the version of the antecedent event, vn
is the version of the successive event, l
is the event's label and p
is the JSON payload document.
- Optionally, the
n
query parameter can be applied to limit the scan batch size. - Optionally, the
reverse
query parameter can be applied to scan in reversed order. - Optionally, the
skip_first
query parameter can be applied to skip the first event.
The GET /meta
endpoint returns all metadata as a JSON document.
Websocket connections can be established on the GET /subscription
endpoint.
Connected websockets will receive hexadecimal numbers representing the latest database version when a new event was pushed.