approveAndApplyControlRequest
Requires at least one of the permissions approvals:bills:approve, approvals:credit:approve, approvals:credit_notes:approve, approvals:discounts:approve, approvals:large_orders:approve, approvals:order_changes:approve, approvals:payments:verify, approvals:stock_adjustments:approve, approvals:supplier_payments:approve or purchase:purchase_order:approve.
Approves a pending approval request, then runs its held action as you, so every control checks it again and the action's own rules apply. The approval is recorded even when the action does not run (for example when you lack the action's permission, or another control refuses); the result says why, and the request stays approved for someone to apply. Same signer rules as approveControlRequest.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
mutation ApproveAndApplyControlRequest($id: ID!) {
approveAndApplyControlRequest(id: $id) {
applied
refusal {
code
approvalRequestId
decisionId
message
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation ApproveAndApplyControlRequest($id: ID!) {\n approveAndApplyControlRequest(id: $id) {\n applied\n refusal {\n code\n approvalRequestId\n decisionId\n message\n }\n }\n}",
"variables": {
"id": "id"
}
}
EOF
Variables:
{
"id": "id"
}
Response:
{
"data": {
"approveAndApplyControlRequest": {
"applied": true,
"refusal": {
"code": "string",
"approvalRequestId": "string",
"decisionId": "string",
"message": "string"
}
}
}
}
approveAndApplyControlRequest(
id: ID!
note: String
): ControlApprovalApplyResult!
Arguments
approveAndApplyControlRequest.id ● ID! non-null scalar
The approval request's ID.
approveAndApplyControlRequest.note ● String scalar
An optional note, up to 500 characters.
Type
ControlApprovalApplyResult object
The outcome of applying an approved request: the request as it stands, and whether its held action ran.