Register a live connection
const url = 'http://127.0.0.1:7700/api/pair/identity';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"identity":"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"}'};
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:7700/api/pair/identity \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "identity": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" }'Tells the box which SpacetimeDB identity this caller holds, so the box vouches for it. After that, the
answer reducer accepts approvals from that connection and records them under the caller’s name: the
device’s name for a paired phone, box screen for the box’s own screen. Accepted from the box’s own screen,
or from a paired device with its token. A phone can also send identity when it redeems its pairing code.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
The 64 hex characters of the SpacetimeDB identity, from identity.toHexString().
Example
{ "identity": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"}Responses
Section titled “Responses”The identity the box now vouches for, and the name it records answers under.
object
Example
{ "identity": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef", "name": "My phone"}The identity is not 64 hex characters.
object
What went wrong
Example generated
{ "error": "example"}Not the box’s own screen, and no paired device’s token.
object
What went wrong
Example generated
{ "error": "example"}GurtOS is open source under the Apache License 2.0.Source code on GitHub.