Chapter 23: API Integration and Automation

Automating methodology operations and integrating with external systems using Guardian's REST API framework

Chapter 22 covered manual testing workflows. Chapter 23 shows you how to automate these processes using Guardian's comprehensive API framework. Using the same VM0033 patterns, you'll learn to automate data submission, integrate with monitoring systems, and build testing frameworks that scale.

Guardian's APIs enable programmatic access to all functionality available through the UI. This automation capability transforms methodology operations from manual processes into scalable, integrated systems that connect with existing organizational infrastructure.

Guardian API Framework Overview

Authentication and API Access

Guardian uses JWT-based authentication for API access. All API calls require authentication headers except for initial login and registration endpoints.

Access Token API:

curl 'https://guardianservice.app/api/v1/accounts/access-token' \
  -H 'sec-ch-ua-platform: "macOS"' \
  -H 'Referer: https://guardianservice.app/login' \
  -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36' \
  -H 'Accept: application/json, text/plain, */*' \
  -H 'sec-ch-ua: "Not;A=Brand";v="99", "Google Chrome";v="139", "Chromium";v="139"' \
  -H 'Content-Type: application/json' \
  -H 'sec-ch-ua-mobile: ?0' \
  --data-raw '{"refreshToken":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjAzMDU2OWVkLThjZWQtNGVmNS05ZjBlLTgwNDAwNjJhMWZiOCIsIm5hbWUiOiJnYXV0YW0iLCJleHBpcmVBdCI6MTc4ODkzNTYwMzYxMywiaWF0IjoxNzU3Mzk5NjAzfQ.JiaVXown792eHo2qxA2_d7VTrLdIL9zIPZ0UI-gZBtGn6ddSIVWsgwO2VRjGEsOHiymQNe8G4o8EwR79StZcfvz762ra52St38Gy9f_MQwVWCLv42oxqPTT8xTep41nnJoZbk85NQSR2rC6zrih4gV6Ue1MIj80TpJfwWC0Lz_4"}'

Refresh token is available in response of login(or loginByEmail) endpoints

Base API URL Pattern: All Guardian APIs follow the pattern: https://guardianservice.app/api/v1/. If you're using local setup - host would update to http://localhost:3000 depending on your port configuration.

For dry-run operations, the typical URL structure is:

  • Policy blocks: /api/v1/policies/{policyId}/blocks/{blockId}

  • Dry-run operations: /api/v1/policies/{policyId}/dry-run/

VM0033 Policy API Structure

Submitting data via APIs is much faster than manual form filling if schema is too big. Using the VM0033 policy JSON we analyzed, here's how API endpoints map to actual policy blocks:

VM0033 Key Block IDs from Policy JSON:

  • PDD Submission Block: 55df4f18-d3e5-4b93-af87-703a52c704d6 - UUID of add_project_bnt

  • Monitoring Report Block: 53caa366-4c21-46ff-b16d-f95a850f7c7c - UUID of add_report_bnt

For every dry run triggered, these IDs change so make sure you have the latest ones.

Add Project Button JSON config

API Endpoint Construction:

Authorization header can be extracted via dev tools console

Dry-Run API Operations

Virtual User Management for API Testing

Guardian's dry-run APIs enable automated testing with virtual users, simulating multi-stakeholder workflows programmatically.

Creating and Managing Virtual Users:

Automated Workflow Execution

Using dry-run APIs, you can execute complete VM0033 workflows programmatically to validate methodology implementation.

Complete VM0033 Workflow Automation:

Automated Testing Frameworks

Cypress Testing Integration

Building on Guardian's API patterns, you could create automated testing suites that validate methodology implementation across multiple scenarios.

VM0033 Cypress Test Suite(Sample):

Chapter Summary

API integration transforms Guardian methodology implementations from manual processes into automated, scalable systems. Using VM0033's patterns, you can automate data submission, integrate with external monitoring systems, build comprehensive testing frameworks, and manage production operations efficiently.

Key API Integration Patterns:

Automated Data Submission:

  • PDD and monitoring report API automation using requestVcDocumentBlock endpoints

  • Multi-year monitoring data generation and submission workflows

  • Error handling and validation for automated submissions

Dry-Run API Operations:

  • Virtual user creation and management for multi-stakeholder testing

  • Programmatic workflow execution and validation

  • Artifact collection and analysis for testing validation

External System Integration:

  • IoT sensor data transformation and submission to Guardian monitoring workflows

  • Registry integration with automated project listing and status synchronization

  • Real-time data pipeline integration for continuous monitoring operations

Production API Management:

  • Rate limiting and retry logic for robust production operations

  • Performance testing and load validation for production scalability

  • Error handling and monitoring for long-term operational reliability

Implementation Workflow:

  1. Establish API authentication and access token management

  2. Map policy block IDs to API endpoints using policy JSON structure

  3. Build automation scripts for data submission and workflow execution

  4. Create testing frameworks using Cypress and Guardian's dry-run APIs

  5. Integrate external systems through data transformation and API orchestration

  6. Deploy production monitoring with error handling and performance optimization

API integration enables methodology implementations that scale from prototype testing to production operations, supporting hundreds of projects and thousands of stakeholders while maintaining accuracy and compliance with methodology requirements.


Next Steps: This completes Part VI: Integration and Testing. Your methodology implementation is now ready for production deployment with comprehensive testing coverage and scalable API automation capabilities.

Last updated