Overview
Pre-Request Scripts in eZintegrations are code segments that execute automatically before an API request is sent.
They allow users to modify request data after variables are resolved and before transmission, ensuring that requests are accurate, secure, and up to date.
When to Use
Use Pre-Request Scripts when requests require dynamic modification or validation before execution.
- Generating authentication tokens or signatures
- Setting dynamic headers
- Updating request parameters at runtime
- Automating repetitive configuration tasks
- Ensuring request data consistency
How It Works
Pre-Request Scripts run immediately before a request is executed in the integration pipeline.
At this stage, all variables have already been resolved. The script can access and modify headers, parameters, and request bodies before the request is sent to the target system.
Once the script completes execution, the modified request is processed and transmitted.
Key Capabilities
Pre-Request Scripts provide flexible control over outgoing API requests.
- Dynamic header generation
- Authentication and security token creation
- Request payload manipulation
- Parameter validation
- Automated data preparation
Example Use Case
A common use case for Pre-Request Scripts is generating signatures or tokens required for secure authentication.
For example, a script can create a digital signature and insert it into the Authorization header before sending the request.
How to Use Pre-Request Scripts
Follow these steps to configure and use Pre-Request Scripts in eZintegrations.
- Open the Integration Bridge configuration.
- Select the API source, operation, or target.
- Navigate to the Pre-Request Script section.
- Enter the required script logic.
- Save the configuration.
- Test the request to verify script execution.
Benefits
Using Pre-Request Scripts improves automation, security, and operational efficiency.
- Reduces manual configuration
- Ensures consistent authentication
- Minimizes request errors
- Supports dynamic integrations
- Improves maintainability
Frequently Asked Questions
What is a Pre-Request Script in eZintegrations?
A Pre-Request Script is code that runs before an API request is executed to modify or prepare request data.
When are Pre-Request Scripts executed?
They are executed after variable resolution and immediately before the request is sent.
Can Pre-Request Scripts modify headers?
Yes. They can dynamically create or update request headers.
Are Pre-Request Scripts required for all APIs?
No. They are optional and used only when dynamic processing is needed.
Can Pre-Request Scripts be used for authentication?
Yes. They are commonly used to generate tokens and signatures for secure authentication.
Notes
- Keep scripts simple and well-documented.
- Avoid hardcoding sensitive credentials.
- Test scripts in a staging environment.
- Review scripts regularly for security compliance.
- Maintain backups before making major changes.