Simple Workflow automation with Autovars
Often when working with APIs, there is a sequence of requests that are each dependent on the previous response. This can be really annoying during testing, resulting in a lot of copy-paste between endpoints, or weird tool-specific custom scripts. Callosum autovars provide a way to automatically extract values from a response, and copy them to a variable for reuse. This is enabled within the tool by applying a JSON Pointer (e.g. that identifies which field of a JSON response to extract) to every response received.
Callosum defines autovars through the use of an OpenAPI Link object named x-6a-autovars
attached to the endpoint response data. The operationRef
for this Link is set to https://ref.callosum.dev/autovars to ensure that any tools using Links have multiple avenues to identify the content.
Example:
paths:
/posts/{postId}:
get:
operationId: get-post
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/post"
links:
x-6a-autovars:
parameters:
"@userId": $response.body#/userId
operationRef: https://ref.callosum.dev/autovars
Here’s short video loop showing what this looks like in the Callosum app!