Building Complex Request Flows
The CAPost request builder seamlessly handles multiple complex authentication strategies and stateful test execution.
1. Advanced Authentication Support
- OAuth2.0 Auto-Refresh: Automatically fetches, caches, and refreshes
access_tokencredentials via implicit, authorization code, and client-credential grant flows. - AWS Signature Version 4 (SigV4): Native signing for requests targeting S3, DynamoDB, and CloudWatch.
- mTLS & Client Certificates: Attach custom PEM certificate and private key pairs directly into the vault.
2. Pre-Request & Post-Response Scripts
Using the embedded QuickJS runtime, execute JavaScript to prepare payloads or extract tokens:
// Pre-Request QuickJS Script
function generateCSRFToken(request) {
// Intercept response from API to grab CSRF token
let res = postman.sendRequest({
url: postman.getGlobalVariable("BASE_URL") + "/csrf",
method: "GET"
});
let token = res.json().csrfToken;
postman.setEnvironmentVariable("CSRF_TOKEN", token);
request.headers.update({ "X-CSRF-TOKEN": token });
}
3. Sequential Chaining & Variables
Chain multiple API requests to extract values into execution variables:
- Collection Variables: Available to all scripts within a workspace.
- Execution Variables: Temporarily stored in RAM during a single runner cycle.
- JSON Path / Regex Extraction: Automatically capture generated IDs like
$.response.data.order_idto be used in subsequent API routes.