Approve or deny
const url = 'http://127.0.0.1:7700/api/approvals/t3k9x2a1b2.budget.example.spend%3A9f2c41d07a6be315';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"approved":true,"by":"portal"}'};
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/approvals/t3k9x2a1b2.budget.example.spend%3A9f2c41d07a6be315 \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "approved": true, "by": "portal" }'Answers one approval. The first answer wins: an approval that is already answered is returned
unchanged. approved must be true to approve; any other value denies.
From a paired device, the log records the device’s name as who answered, whatever by says. by
is used only when the box’s own screen answers. Percent-encode an id that holds spaces, such as
one made from Droid’s own question.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The approval id, <task id>.<key>.
Example
t3k9x2a1b2.budget.example.spend:9f2c41d07a6be315Request Bodyrequired
Section titled “Request Bodyrequired”object
true approves. Anything else denies.
Who answered, for the log, when the box’s own screen answers. Default api. Ignored from a paired device.
Example
{ "approved": true, "by": "portal"}Responses
Section titled “Responses”The approval after the answer, or as it was if someone answered first.
object
<task id>.<key>. The same key asked twice is the same approval.
The question shown to people.
The spending being asked about
Who gets paid
What the spend or action is for.
Who answered: a paired device’s name, what the box’s own screen sent (such as box screen), jira:<name>, asi1, undo, or task ended.
Example
{ "state": "pending"}No approval with this id.
object
What went wrong
Example
{ "error": "no approval t3k9x2a1b2.deploy"}An outside request with no device token, or with one that is unknown or revoked.
object
What went wrong
Example
{ "error": "pair this phone with the box first"}GurtOS is open source under the Apache License 2.0.Source code on GitHub.