AppendSession
(available via most SDKs), you can pipeline batches with an ordering guarantee, and receive acknowledgements back in the corresponding order. If any batch fails, subsequent batches will not become durable.
Concurrency control
Appends support two mechanisms for concurrency control:Match sequence
Specifying expected current state allows optimistic concurrency control. You can provide the sequence number that you expect S2 to assign to the first record in a batch as thematch_seq_num
.
If it does not match, this will result in a 412 Precondition Failed
status or corresponding SDK error type.
Fencing token
Fencing is a form of pessimistic concurrency control. It is a cooperative mechanism, so an append that does not specify a fencing token will still be allowed. When an append does include afencing_token
and it does not match, this results in a 412 Precondition Failed
status or corresponding SDK error type.
Setting the current fencing token itself requires appending to the stream, with the fence
command.Authorizations
Bearer authentication header of the form Bearer <token>
, where <token>
is your access token.
Headers
Defines the interpretation of record data (header name, header value, and body) with the JSON content type.
Use raw
(default) for efficient transmission and storage of Unicode data — storage will be in UTF-8.
Use base64
for safe transmission with efficient storage of binary data.
raw
, base64
Path Parameters
Stream name.
Body
Payload of an append
request.
Batch of records to append atomically, which must contain at least one record, and no more than 1000. The total size of a batch of records may not exceed 1 MiB of metered bytes.
Enforce a fencing token, which starts out as an empty string that can be overridden by a fence
command record.
Enforce that the sequence number assigned to the first record matches.
x >= 0
Response
Success response to an append
request.
Sequence number of the last record that was appended + 1
, and timestamp of the last record that was appended.
The difference between end.seq_num
and start.seq_num
will be the number of records appended.
Sequence number and timestamp of the first record that was appended.
Sequence number that will be assigned to the next record on the stream, and timestamp of the last record on the stream.
This can be greater than the end
position in case of concurrent appends.