Axios Integration Package
Overview
The Axios integration package allows you to use the popular Axios library directly within your Retrieve integrations. Axios is one of the most widely-used HTTP clients in the JavaScript ecosystem, with over 100 million weekly downloads on NPM, making it a familiar and trusted tool for developers.
This utility package is especially valuable for integrating with custom systems, proprietary APIs, or any web service that doesn't have a dedicated integration package. Since Axios is so popular, many developers already know how to use it, making it easy to build custom integrations without learning new tools. You write standard Axios code in your rewrite functions, giving you complete control over HTTP requests to any endpoint.
Key Features
🌐 Industry Standard
Built on Axios - the most popular HTTP client with 100M+ weekly downloads. Use familiar syntax that developers already know.
🔧 Custom System Integration
Perfect for proprietary APIs, legacy systems, or any custom web service that needs HTTP communication.
📝 Custom Logic
Write JavaScript functions to handle request configuration, response parsing, and error handling exactly as needed.
🔄 Workflow Mode
Fully compatible with workflow mode for building multi-step integrations with custom API calls at any stage.
🔐 Authentication Support
Configure any authentication method: API keys, Bearer tokens, Basic Auth, OAuth, or custom headers.
⚡ Promise-Based
Built on Axios's promise-based architecture for clean async/await patterns and error handling.
Configuration
The Axios package does not require mandatory configuration at the integration level. All configuration is done within your custom rewrite functions, giving you complete control over each request.
Optional: Node-Specific Configuration (Workflow Mode)
In workflow mode, you can configure Axios settings per node:
{
"axios": {
"baseURL": "https://api.example.com",
"timeout": 30000,
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json",
"Accept": "application/json"
}
}
}| Parameter | Type | Description |
|---|---|---|
baseURL | string | Base URL for all requests (optional) |
timeout | number | Request timeout in milliseconds (default: 30000) |
headers | object | Default headers to include in all requests |
auth | object | HTTP Basic Auth credentials: { username, password } |
Common Use Cases
🔗 Custom System Integration
The primary use case for this package - integrate with proprietary systems, internal APIs, legacy applications, or any custom web service built for your specific business needs. Since you're using Axios, developers can leverage their existing knowledge and the extensive Axios documentation available online.
🏢 Third-Party Services
Connect to third-party services without dedicated packages: payment processors, shipping calculators, tax services, address validation APIs, CRM systems, or marketing automation platforms.
📊 Data Enrichment
Fetch additional data from external APIs to enrich your integration workflows. For example, validate addresses, check inventory from external systems, or retrieve exchange rates.
🔔 Webhooks & Notifications
Send custom webhook notifications to external systems, trigger alerts, or post data to monitoring services during your integration workflows.
🧪 Prototype & Testing
Quickly prototype integrations with new APIs or test API endpoints before building a dedicated integration package.
Best Practices
Always Include Error Handling
Wrap your Axios calls in try/catch blocks and handle different error scenarios (network errors, 4xx, 5xx responses). Return meaningful error messages to help with debugging.
Use Environment-Specific Configuration
Store API credentials and endpoints in your integration configuration rather than hardcoding them. This makes it easy to use different credentials for development, staging, and production.
Respect Rate Limits
Many APIs have rate limits. Implement appropriate delays, handle 429 responses, and consider using the built-in retry functionality or custom backoff logic.
Log Request Details
Use console.log to track request URLs, methods, and response status codes. This helps with debugging and monitoring your integration performance.
Validate Response Structure
Always validate the structure of API responses before processing data. APIs can change, and defensive coding prevents unexpected failures.
Example Integration Flow
Multi-Step API Workflow
Retrieve new orders from Magento
Call external address validation API
Query warehouse management system
Create orders in Shopify with validated data