
api-gw-lite
Pricing
Pay per usage

api-gw-lite
This actor serves as a proxy that accepts requests with custom field names and translates them to standard HTTP requests to target APIs. It's designed to work seamlessly on the Apify platform while also supporting local testing
0.0 (0)
Pricing
Pay per usage
1
Total users
1
Monthly users
1
Last modified
15 hours ago
Simple API Gateway Actor
A lightweight, efficient API Gateway that forwards HTTP requests to target APIs with proxy support and structured results.
Overview
This Apify Actor serves as a simple HTTP client that accepts requests with intuitive field names and forwards them to target APIs. It's designed for simplicity and efficiency, focusing on core functionality without unnecessary complexity.
Key Features
- ✅ All HTTP methods (GET, POST, PUT, DELETE, PATCH, OPTIONS, HEAD)
- ✅ Custom headers and authentication support
- ✅ URL query parameters handling
- ✅ JSON request bodies for POST/PUT/PATCH
- ✅ Apify proxy integration for IP rotation
- ✅ Structured results in Apify Results tab
- ✅ Error handling with graceful HTTP error responses
- ✅ Lightweight - single file implementation
Input Configuration
Required Fields
destination
(string): The target URL endpoint
Optional Fields
actionType
(string): HTTP method (default: "GET")requestSignals
(object): HTTP headersqueryDetails
(object): URL query parameterspayloadContent
(object): JSON request bodyproxySettings
(object): Proxy configuration
Usage Examples
1. Simple GET Request
{"actionType": "GET","destination": "https://jsonplaceholder.typicode.com/posts/1","requestSignals": {"User-Agent": "ApifyActor/1.0","Accept": "application/json"},"queryDetails": {"format": "json","limit": "10"}}
2. POST with JSON Body
{"actionType": "POST","destination": "https://jsonplaceholder.typicode.com/posts","requestSignals": {"Content-Type": "application/json","Authorization": "Bearer your-token-here"},"payloadContent": {"title": "Sample Post","body": "This is a test post","userId": 1}}
3. API with Authentication
{"actionType": "GET","destination": "https://api.github.com/user/repos","requestSignals": {"Authorization": "token ghp_your_github_token_here","Accept": "application/vnd.github.v3+json"},"queryDetails": {"type": "owner","sort": "updated","per_page": "5"}}
4. With Proxy Settings
{"actionType": "GET","destination": "https://httpbin.org/ip","requestSignals": {"Accept": "application/json"},"proxySettings": {"useApifyProxy": true,"apifyProxyGroups": ["RESIDENTIAL"]}}
Field Mapping
Input Field | Maps To | Purpose |
---|---|---|
actionType | HTTP Method | GET, POST, PUT, DELETE, etc. |
destination | Target URL | Complete endpoint URL |
requestSignals | HTTP Headers | Authorization, Content-Type, etc. |
queryDetails | Query Parameters | URL parameters (?key=value) |
payloadContent | Request Body | JSON data for POST/PUT requests |
proxySettings | Proxy Config | Apify proxy settings |
Output Format
The actor provides two types of output:
Results Tab (Dataset)
{"success": true,"status_code": 200,"content_type": "application/json","full_response": { "...actual API response..." }}
Key-Value Store (OUTPUT)
Complete raw response including all headers and metadata.
File Structure
├── apify_main.py # Main Actor implementation├── Dockerfile # Docker configuration├── requirements.txt # Python dependencies├── INPUT.json # Example configurations├── README.md # This documentation└── .actor/├── actor.json # Actor metadata└── input_schema.json # Input validation schema
Requirements
httpx
- HTTP client libraryapify
- Apify SDK for Python
Error Handling
The actor gracefully handles:
- ❌ Invalid URLs or network issues
- ❌ Authentication failures
- ❌ HTTP error status codes (4xx, 5xx)
- ❌ Malformed JSON responses
- ❌ Proxy connection issues
All errors are logged with detailed messages and returned in structured format.
Running the Actor
On Apify Platform
- Upload this actor to Apify
- Configure input using the examples in
INPUT.json
- Run the actor
- View results in the "Results" tab
Local Testing
$python apify_main.py
Common Use Cases
- API Testing - Test REST API endpoints
- Data Collection - Fetch data from APIs
- Webhook Forwarding - Forward requests to internal APIs
- Authentication Testing - Test different auth methods
- Proxy Testing - Test APIs through different IP addresses
Tips
- Use
httpbin.org
endpoints for testing - Check the "Results" tab for formatted output
- Enable Apify proxy for IP rotation
- Add proper
User-Agent
headers for better success rates - Use
Content-Type: application/json
for JSON payloads
Simple, efficient, and reliable API Gateway for all your HTTP request needs! 🚀