Skip to content

Invoke a named view

POST
/api/v1/views/{name}/invoke
curl --request POST \
--url 'http://localhost:11044/api/v1/views/example/invoke?background=false' \
--header 'Content-Type: application/json' \
--header 'X-Embabel-Api-Key: <X-Embabel-Api-Key>' \
--data '{ "args": { "additionalProperty": "example" }, "idempotencyKey": "example" }'

Run an authored Virtual-Cypher view by name and return a redacted, typed result envelope. The runnable query is never exposed. background=true starts it as a background run instead and returns at once: WAITING_INPUT with the quote under choice when it costs more than one request may spend inline, which runs only once its owner answers, otherwise RUNNING. Either way the envelope’s executionId is the run: poll GET /views/runs/{runId}, answer POST /views/runs/{runId}/answer, stop POST /views/runs/{runId}/kill. Without it the call is synchronous, as it always was.

name
required
string

The authored view name

background
boolean

Run it in the background and return its envelope at once; an over-budget run waits, quoted, for its owner’s answer

The view’s arguments under args, keyed by its declared parameter names; an argument that is missing or does not fit the view’s parameters is refused with 400. Omitting the body, or args, runs the view on its defaults. Any top-level field other than args and idempotencyKey is refused with 400 rather than ignored; idempotencyKey is accepted but does not deduplicate invocations here

Media typeapplication/json

The body of POST /lenses/{lensId}/invoke and POST /views/{name}/invoke: arguments and an optional idempotency key. Any other top-level field is refused with 400.

object
args
required

Arguments by the lens’s or view’s declared parameter name. A name it does not declare, or a required parameter left out, is refused with 400; an optional one left out takes its declared default

object
key
additional properties
idempotencyKey

Accepted but not yet acted on: a repeated call with the same key runs again

string

Example generated

{
"args": {
"additionalProperty": "example"
},
"idempotencyKey": "example"
}

Arguments do not match the view’s declared parameters, or the body has a field other than args/idempotencyKey; a body that will not parse answers an ApiError

One of:

A request-level refusal from the headless surface. Carries only the reason; an execution that ran and failed answers 200 with the outcome in its envelope instead

object
error
required

Why the request was refused, written to be shown: the unknown lens, view or run, the argument at fault, or the field the body should not have

string

Example generated

{
"error": "example"
}

Not authenticated. The filter chain answers an ApiError; a principal that resolves to no user answers the refusal

One of:

A request-level refusal from the headless surface. Carries only the reason; an execution that ran and failed answers 200 with the outcome in its envelope instead

object
error
required

Why the request was refused, written to be shown: the unknown lens, view or run, the argument at fault, or the field the body should not have

string

Example generated

{
"error": "example"
}

No such view

Media typeapplication/json

A request-level refusal from the headless surface. Carries only the reason; an execution that ran and failed answers 200 with the outcome in its envelope instead

object
error
required

Why the request was refused, written to be shown: the unknown lens, view or run, the argument at fault, or the field the body should not have

string

Example generated

{
"error": "example"
}