Store the session's work so far, which becomes its diff (own session token only)
const url = 'http://127.0.0.1:8080/v1/sessions/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/snapshots';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"base_commit":"example","numstat":[{"path":"example","added":1,"deleted":1,"binary":true}],"symbols":[{"kind":"func","name":"example","normalized":"example","path":"example","lang":"example","signature":"example","doc":"example"}],"patch":"example","patch_truncated":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://127.0.0.1:8080/v1/sessions/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/snapshots \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "base_commit": "example", "numstat": [ { "path": "example", "added": 1, "deleted": 1, "binary": true } ], "symbols": [ { "kind": "func", "name": "example", "normalized": "example", "path": "example", "lang": "example", "signature": "example", "doc": "example" } ], "patch": "example", "patch_truncated": true }'A snapshot is cumulative against the session’s base commit. The
patch and each symbol’s signature and doc pass the secret scan, and
a hit sets redacted. The symbols are matched against the other
active sessions’ latest snapshots and current plans, and both
sessions of each overlap get an overlap_symbol or
symbol_near_duplicate notice. A symbol whose doc comment is close
to the doc of another session’s snapshotted symbol of the same kind
is a near duplicate too, whatever the names (ADR-0017). A repeat folds into the unacked
notice. A session sends at most 30 snapshots a minute.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
object
Canonical repository path, once per snapshot.
A binary file has added and deleted 0.
object
Bytes, on one line, with no outer spaces.
Ignored on input; the coordinator recomputes it.
Canonical repository path.
One line, at most 200 characters.
One line, at most 300 characters.
A unified diff, at most 524288 bytes.
The sender cut the patch to fit.
Responses
Section titled “Responses”Stored.
object
object
object
Empty for a symbol from a plan.
object
Empty for a symbol from a plan.
Set on a symbol_near_duplicate whose doc comments matched: the
cosine of the two doc texts, rounded to three places. similarity
is still the names’ similarity, which may be low (ADR-0017).
Up to three of the session’s most urgent undelivered notices, one line each, after a “Zentri notices:” header. A last line says how many more wait. Showing a notice here marks it delivered but not acked. Absent when nothing is undelivered or the caller is not the session’s own token.
Example
{ "overlaps": [ { "kind": "overlap_symbol", "symbol": { "kind": "func" }, "other": { "kind": "func", "source": "plan" } } ]}The request is malformed.
object
object
Example generated
{ "error": { "code": "example", "message": "example" }}No valid bearer token.
object
object
Example generated
{ "error": { "code": "example", "message": "example" }}The token may not do this.
object
object
Example generated
{ "error": { "code": "example", "message": "example" }}No such resource in the caller’s org.
object
object
Example generated
{ "error": { "code": "example", "message": "example" }}The request clashes with current state.
object
object
Example generated
{ "error": { "code": "example", "message": "example" }}The request is well formed but breaks a rule or a limit.
object
object
Example generated
{ "error": { "code": "example", "message": "example" }}A rate limit or quota stopped the request. Retry-After gives seconds to wait.
object
object
Example generated
{ "error": { "code": "example", "message": "example" }}