Create & Sync API Collections From Backend Code with Agent Mode

Quick Overview

The video demonstrates successfully connecting a Postman workspace to a local file system and using Agent Mode to automatically generate and update an API collection (Feature Flags API) based on changes detected in the backend Flask application code (app.py), subsequently creating a new request for a disabled feature flag endpoint.

Key Points: The Postman workspace successfully connected to the local file system, allowing Agent Mode to scan and detect API definitions from the backend Flask application file, app.py. Agent Mode automatically created a Postman collection named "Feature Flags API (from app.py)" containing endpoints discovered in the Flask code, including GET, POST, and DELETE methods for feature flags. The initial collection was missing the POST request for disabling a feature flag, which the user then manually added as a requested next step. After adding the new POST endpoint to app.py and instructing Agent Mode to update the collection, the agent successfully synchronized the changes, adding the missing endpoint and updating other request details. The final synchronization confirmed the backend was synced with the latest collection updates, noting specific changes like GET support for filtering enabled/disabled flags. The process showcases the workflow of keeping Postman collections synchronized with backend code changes using the filesystem connection and Agent Mode.

Context: This tutorial demonstrates an advanced workflow within Postman, specifically utilizing the 'API Network' feature that allows connecting a Postman workspace directly to a local file system. The goal is to leverage Postman's Agent Mode to automatically scan source code (here, a Flask application defined in app.py) and generate or update a corresponding API collection, thereby ensuring the collection accurately reflects the current backend API structure.

Detailed Analysis

The demonstration begins by connecting the Postman workspace to the local file system containing a 'feature-flags-prod' directory, which holds a Flask application defined in 'app.py'. Upon successful connection, the user chooses to use 'Agent Mode' to generate a collection from the filesystem. Agent Mode scans 'app.py', detects the Flask API endpoints, and creates a Postman collection named 'Feature Flags API (from app.py)'. The initial comparison shows that all detected endpoints are present except for POST /featureflags/:flagid/disable. The user then manually adds this missing endpoint definition to the 'app.py' file. After saving the code change, the user instructs Agent Mode to update the collection based on the modified backend code. The debug log confirms that Agent Mode reads the updated files, finds the new endpoint, and regenerates the collection, successfully incorporating the 'Disable feature flag' request. The final output confirms the backend is now synced with the latest collection updates, highlighting changes like enhanced GET support and updated base URLs, illustrating a seamless, code-driven API collection management lifecycle.

Raw markdown version of this recap