Make an Apple Watch token
POST
/devices/self/watch
const url = 'http://127.0.0.1:7700/api/devices/self/watch';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"example"}'};
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/devices/self/watch \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "example" }'Only a device that paired as iphone. Returns a separate token for its Apple Watch, with the
iPhone’s Business person and nothing more. It is never the owner’s, so Settings, keys, setup, apps and
devices are refused. It cannot vouch for a SpacetimeDB identity, and it approves only up to Settings
watchLimitCents. A new Watch token replaces the old one, three an hour per iPhone. Revoking the
iPhone revokes it too.
Authorizations
Section titled “Authorizations”Request Body
Section titled “Request Body”Media typeapplication/json
object
name
The Watch’s name. Default <phone name>'s Watch.
string
Example generated
{ "name": "example"}Responses
Section titled “Responses”The Watch’s token.
Media typeapplication/json
object
token
required
string
device
required
object
id
string
name
string
Example generated
{ "token": "example", "device": { "id": "example", "name": "example" }}The caller is not the iPhone app.
Media typeapplication/json
object
error
required
What went wrong
string
Example generated
{ "error": "example"}This iPhone added a Watch three times this hour.
Media typeapplication/json
object
error
required
What went wrong
string
Example generated
{ "error": "example"}