Generate Variables & Insert into Collections
Automatically generate and manage variables for API collections with intelligent variable detection and seamless integration.
What it Does
The Generate Variables feature analyzes your API collection to identify reusable values and automatically generates corresponding variables. These variables are presented as key-value pairs that can be selectively added to your collection's global variables, replacing hardcoded values with dynamic references.
Key Benefits:
- Intelligent Detection: Automatically identifies reusable content across multiple requests
- Bulk Operations: Insert multiple variables efficiently in a single action
- Dynamic Replacement: Converts static values to variable references using
{{variable}}
syntax - Flexible Management: Accept, edit, or reject suggested variables based on your needs
Use Cases
Primary Use Cases
- Large-Scale Collections: Efficiently manage collections with numerous API requests containing repetitive data
- Environment Configuration: Set up consistent variables across different environments (dev, staging, production)
- Data Standardization: Ensure consistent values across multiple API endpoints
- Maintenance Efficiency: Centralize commonly used values for easier updates and maintenance
Specific Scenarios
- Authentication Tokens: Replace hardcoded API keys and tokens with variables
- Base URLs: Convert endpoint URLs to use configurable base URL variables
- User IDs: Standardize user identifiers across different API calls
- Configuration Values: Manage application settings and configuration parameters
- Test Data: Organize test datasets with reusable variables
Step-by-Step Guide
Getting Started
Step 1: Access Generate Variables
-
Navigate to your collection in the left sidebar panel
-
Click on the Collection Name (the main heading of your collection)
-
A new tab labeled "Generate Variables" will appear
-
Click on the "Generate Variables" tab to open the feature
Step 2: Review Generated Variables
Once opened, you'll see a two-panel interface:
Top Panel - Current Global Variables
- Displays existing global variables for the current workspace
- Shows variables that are already configured and in use
- Provides context for avoiding duplicate variable names
Bottom Panel - Generated Variables
-
Contains AI-detected variables from your collection
-
Shows suggested key-value pairs based on reusable content
-
Each variable includes the detected value and suggested variable name
Managing Variables
Step 3: Select Variables to Add
You have multiple options for managing the generated variables:
Individual Selection
-
Accept single variables by clicking the ✓ (tick mark) next to each item
-
Use this for selective variable addition when you only need specific variables
Bulk Operations
-
Accept all variables at once using the "Accept All" button
-
Ideal for collections where most suggested variables are relevant
Step 4: Edit and Customize Variables
Edit Variable Details
-
Modify variable names to follow your naming conventions
-
Update values to match your specific requirements
-
Customize keys for better organization and clarity
Undo and Revert Options
-
Undo individual changes using the undo button next to each variable
-
Revert all changes to return to the original generated state
-
Selective reversion for specific variables only
Step 5: Save and Apply Changes
Final Review and Save
-
Review your selections in the top panel to ensure all desired variables are included
-
Verify variable names and values are correct and follow your conventions
-
Click "Save" to confirm and apply the variables to your collection
Results and Integration
Step 6: Variable Integration
After saving, the system automatically:
Replaces Values with Variables
-
Converts hardcoded values in your API requests to variable references
-
Uses the standard
{{variableName}}
syntax for variable substitution -
Updates all relevant requests across the collection
Maintains Request Functionality
- All API requests continue to work with the new variable references
- Variables are resolved at runtime using the global variable values
- No disruption to existing request functionality
Learning and Support
Step 7: Interactive Tour Guide
Automatic Tour Detection
- The system automatically detects when reusable content exists across 3+ requests
- Tour guide automatically appears when significant variable opportunities are found
- Provides contextual guidance for the current collection
Manual Tour Access
-
Click "Show me how" to start the interactive tutorial
-
Follow step-by-step guidance tailored to your specific collection
-
Learn advanced features and best practices through hands-on examples
Best Practices
Variable Naming Conventions
- Use descriptive names:
api_base_url
instead ofurl1
- Follow consistent patterns: Use snake_case or camelCase consistently
- Include context:
auth_token
instead of justtoken
- Avoid conflicts: Check existing variables to prevent naming collisions
Effective Variable Management
- Review before accepting: Verify that generated variables match your use case
- Group related variables: Organize variables by functionality or environment
- Regular maintenance: Periodically review and clean up unused variables
- Documentation: Add comments or descriptions for complex variables
Collection Organization
- Environment-specific variables: Use different variable sets for dev/staging/production
- Hierarchical structure: Organize variables from general to specific
- Backup configurations: Export variable sets before major changes
- Version control: Track variable changes alongside API collection updates
Troubleshooting
Common Issues and Solutions
Variables Not Generated
- Ensure your collection has at least 3 requests with reusable content
- Check that values appear in multiple places across different requests
- Verify the collection is properly saved and accessible
Incorrect Variable Detection
- Review generated variables and reject irrelevant suggestions
- Edit variable names and values to match your requirements
- Use individual selection instead of bulk acceptance for better control
Integration Problems
- Verify that variable names don't conflict with existing variables
- Check that variable values are correctly formatted
- Ensure all affected requests are saved after variable integration
Getting Help
- Use the interactive tour guide for contextual assistance
- Check the generated variables preview before saving
- Test API requests after variable integration to ensure functionality
- Contact support if variables don't integrate properly with your collection
This comprehensive variable generation feature streamlines API collection management while maintaining flexibility and control over your testing environment.