Skip to content

Approve or deny

POST
/approvals/{id}
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.

id
required
string

The approval id, <task id>.<key>.

Example

t3k9x2a1b2.budget.example.spend:9f2c41d07a6be315
Media typeapplication/json
object
approved
required

true approves. Anything else denies.

boolean
by

Who answered, for the log, when the box’s own screen answers. Default api. Ignored from a paired device.

string

Example

{
"approved": true,
"by": "portal"
}

The approval after the answer, or as it was if someone answered first.

Media typeapplication/json
object
id
required

<task id>.<key>. The same key asked twice is the same approval.

string
task
required
string
question
required

The question shown to people.

string
costCents
required

The spending being asked about

number
payee

Who gets paid

string
purpose

What the spend or action is for.

string
state
required
string
Allowed values: pending approved denied
by

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.

string

Example

{
"state": "pending"
}

No approval with this id.

Media typeapplication/json
object
error
required

What went wrong

string

Example

{
"error": "no approval t3k9x2a1b2.deploy"
}

An outside request with no device token, or with one that is unknown or revoked.

Media typeapplication/json
object
error
required

What went wrong

string

Example

{
"error": "pair this phone with the box first"
}

GurtOS is open source under the Apache License 2.0.Source code on GitHub.