Approve or reject a request
const url = 'http://localhost:11044/api/v1/requests/example/decision';const options = { method: 'POST', headers: {'X-Embabel-Api-Key': '<X-Embabel-Api-Key>', 'Content-Type': 'application/json'}, body: '{"decision":"example","reason":"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://localhost:11044/api/v1/requests/example/decision \ --header 'Content-Type: application/json' \ --header 'X-Embabel-Api-Key: <X-Embabel-Api-Key>' \ --data '{ "decision": "example", "reason": "example" }'Approving calls the request’s verb as you, through the gateway. Rejecting needs a reason.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The request’s id
Request Bodyrequired
Section titled “Request Bodyrequired”The decision on a pending request: decision is approve or reject, case-insensitive, and anything else is a 409. Approving runs the request’s verb as the caller and ignores reason; rejecting requires a non-blank reason, which is recorded on the request and in the run ledger
The owner’s decision on an agent’s request, the body of POST /requests/{id}/decision.
object
approve or reject, case-insensitive. Approving calls the request’s verb as the caller.
Why the request is rejected, recorded on it and in the run ledger. Required, and not blank, for reject; ignored for approve.
Example generated
{ "decision": "example", "reason": "example"}Responses
Section titled “Responses”The request after the decision
The outcome of a decision: the request as it now stands (200), or why the decision was refused (409).
object
Why the decision was refused: already decided or expired, a rejection with no reason, or a decision other than approve/reject. Null when it was applied.
The request after the decision — APPROVED, REJECTED, or FAILED when the approved verb call failed. Null when the decision was refused.
object
Whom or what the call is about, by name (e.g. the customer a note goes on); null when the call did not say
Agent whose run raised it, shown to the approver as who is asking; null when no agent holds the routine or a person asked
The verb’s input, as a JSON-encoded string
When it was approved or rejected, or for an expired one its expiresAt, as an ISO-8601 instant; null while pending
Username of the person who approved or rejected it; null while pending and for an expired request
What would happen and why, in the business’s words; what the approver reads first
Rows the routine read that made it ask, as it saw them when it asked; at most 50, empty when it gave none
object
When an unanswered request expires, as an ISO-8601 instant; three days after raisedAt
Identifier of the request, req_ followed by a UUID; the {id} in /requests/{id}
User id of the person in whose world the request was raised, and who decides it
Text the call would write where people read it (a note, a message), as it would land; null when the call writes none or did not say
When it was raised, as an ISO-8601 instant
User id of the person whose own call, made outside any routine run, was held for approval; null when a routine or an agent asked
Display name of raisedBy at the time they asked; null when raisedBy is null
Why it was rejected, as the rejecter wrote it; null unless status is REJECTED
What the verb answered once approved, or its error when status is FAILED, truncated to 2000 characters; null until approved
Name of the routine that raised it; (unnamed routine) when no routine did, as for a person’s own held call
Id of the routine run it was raised in; null when it was raised outside any run
True when the verb’s publisher asks for an approver other than the caller. Advisory: the world does not enforce it
True when it was approved by the same person who raised it (raisedBy); allowed, and recorded so
PENDING until decided; then APPROVED (the verb succeeded), FAILED (approved, but the verb answered an error), REJECTED, or EXPIRED (nobody answered before expiresAt)
Text from outside the business the routine read before asking, each as source: what, sorted; the draft came after it. Empty when it read none
Gateway tool to call on approval, e.g. odoo_partnerMessagePost
Example
{ "request": { "status": "PENDING" }}No authenticated principal
A refusal with a machine-readable code and a plain-language message. ApiErrorAdvice answers it for a failed validation, a missing resource or a conflicting state, and some controllers answer it directly
object
Machine-readable key to branch on, such as validation_failed, unknown_field, not_found or conflict. Open: a surface may answer codes of its own
Extra context where there is some, such as the fields a body may carry; null otherwise
A plain-language explanation, written to be shown. Never carries an exception message
The body the servlet error dispatch answers for a status raised by an exception rather than written by the endpoint. Every failure except 404, which answers the not-found HTML page
object
The status’s standard reason phrase, such as Bad Request or Forbidden
The request path that failed
The HTTP status code, repeated from the status line
Example generated
{ "code": "example", "detail": "example", "message": "example"}No such request in your world
Refused: already decided or expired, a rejection with no reason, or no such decision
The outcome of a decision: the request as it now stands (200), or why the decision was refused (409).
object
Why the decision was refused: already decided or expired, a rejection with no reason, or a decision other than approve/reject. Null when it was applied.
The request after the decision — APPROVED, REJECTED, or FAILED when the approved verb call failed. Null when the decision was refused.
object
Whom or what the call is about, by name (e.g. the customer a note goes on); null when the call did not say
Agent whose run raised it, shown to the approver as who is asking; null when no agent holds the routine or a person asked
The verb’s input, as a JSON-encoded string
When it was approved or rejected, or for an expired one its expiresAt, as an ISO-8601 instant; null while pending
Username of the person who approved or rejected it; null while pending and for an expired request
What would happen and why, in the business’s words; what the approver reads first
Rows the routine read that made it ask, as it saw them when it asked; at most 50, empty when it gave none
object
When an unanswered request expires, as an ISO-8601 instant; three days after raisedAt
Identifier of the request, req_ followed by a UUID; the {id} in /requests/{id}
User id of the person in whose world the request was raised, and who decides it
Text the call would write where people read it (a note, a message), as it would land; null when the call writes none or did not say
When it was raised, as an ISO-8601 instant
User id of the person whose own call, made outside any routine run, was held for approval; null when a routine or an agent asked
Display name of raisedBy at the time they asked; null when raisedBy is null
Why it was rejected, as the rejecter wrote it; null unless status is REJECTED
What the verb answered once approved, or its error when status is FAILED, truncated to 2000 characters; null until approved
Name of the routine that raised it; (unnamed routine) when no routine did, as for a person’s own held call
Id of the routine run it was raised in; null when it was raised outside any run
True when the verb’s publisher asks for an approver other than the caller. Advisory: the world does not enforce it
True when it was approved by the same person who raised it (raisedBy); allowed, and recorded so
PENDING until decided; then APPROVED (the verb succeeded), FAILED (approved, but the verb answered an error), REJECTED, or EXPIRED (nobody answered before expiresAt)
Text from outside the business the routine read before asking, each as source: what, sorted; the draft came after it. Empty when it read none
Gateway tool to call on approval, e.g. odoo_partnerMessagePost
Example
{ "request": { "status": "PENDING" }}
