Skip to content

labs/connector/dataplane

Step Summary
labs/connector/dataplane/api_request Call one operation of an API file through a data plane, and return its answer.

labs/connector/dataplane/api_request

Call one operation of an API file through a data plane, and return its answer.

The request is built from the document as labs/http/api_request builds it, and sent as connector/dataplane/http_request sends: to the dataplane_url and with the edr_token an earlier step published (pull_data_filtered, initiate_transfer, get_edr), unless given; edr_token: '' sends none. Redirects are not followed. Under validate:, labs/validate/api_response with data_plane: true tells a data plane's own refusal (401/403) or failure to reach the API (502/504) apart from an answer of the API.

Inputs

Parameter Type Required Default Also accepts Description
dataplane_url any no None — Data-plane URL, or a data address object to read it from; falls back to the 'dataplane_url' context variable.
edr_token Credential | string no None — EDR authorization token; falls back to the 'edr_token' context variable when omitted. An explicit '' asks for the call to be made with no token at all — e.g. a negative-path test proving the endpoint is protected — and is honoured as given rather than falling back.
headers object no {} — Extra HTTP headers merged into the request.
timeout number no None — Request timeout in seconds; the test's default is used when omitted.
api any yes — — The API file, written '${{ env.apis. }}'. Recorded by its id and digest, never as the document.
operation string yes — — The operation: its operationId, or 'METHOD /path' exactly as the document writes the path.
path_params object no {} — Values of the path's placeholders, by name; each is percent-encoded as one segment.
query object no {} — Query parameters, by name; a list repeats the parameter. Plugs in the 'query' that 'security/api_key' returns.
body any no None — Request body; an object or list is sent as JSON, text as it is.
content_type string no None — Content-Type of the body; omitted, the operation's first documented one (JSON if documented).
accept string no None — Accept header; omitted, the media types the operation documents for its 2XX answers.
expect integer | string no None — The answer the test expects: a status (404), a class ('4XX'), 'success' (2XX) or 'error' (400 and up). Another answer fails the step. A request expected to be refused with a 4xx counts as sent wrong on purpose for 'labs/validate/api_errors'.
base_path string no None — Prefix stripped from the operation's path before it is appended to the data-plane URL, for a document whose paths repeat the asset's base URL. Omitted, the path part of the document's first server URL.

Output — the value assertions and returns: read

Output contract of the API call steps: the answer and the operation it answers.

Field Type Description
status_code integer Status the API answered with.
response_body any Body: parsed JSON for a JSON media type, else text.
response_headers object Response headers, with the casing the server sent.
operation ApiOperationRef The operation called.

Nested objects

ApiOperationRef

The operation an answer belongs to.

Field Type Required Default Also accepts Description
api string yes — — Id of the API file, as declared in env.apis.
id string no None — operationId, when the document gives one.
method string yes — — HTTP method.
path string yes — — Path template, as the document writes it.