API Request Node
Overview
The API Request Node enables integration with external services through HTTP/HTTPS requests. This node supports various request methods, authentication mechanisms, and response parsing capabilities to seamlessly connect your Gravia workflows with third-party APIs and web services.
Usage cost: 1 credit
Configuration
Settings
Request Configuration
Method: HTTP method to use (GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS)
URL*: Target endpoint for the API request
Supports variable interpolation (e.g.,
https://api.example.com/users/{user_id}
)Must include protocol (http:// or https://)
Headers
Key-value pairs for HTTP headers
Common examples:
Content-Type
,Accept
,Authorization
Supports variable interpolation in both keys and values
Query Parameters
Key-value pairs appended to the URL
Automatically URL-encoded
Supports variable interpolation in both keys and values
Request Body (for POST, PUT, PATCH, DELETE methods)
Body Format: Determines how the request body is formatted
JSON: Structured data in JSON format
Form Data: Multipart form data
URL Encoded: Form data as URL-encoded string
Raw: Plain text content
Binary: Binary data
Body Content: The actual content to send
Supports variable interpolation
For JSON, must be valid JSON syntax
Authentication
Authentication Type:
None: No authentication
Basic Auth: Username/password authentication
API Key: Key-based authentication
OAuth 2.0: Token-based authentication
Auth Configuration (varies by type):
Basic Auth: Username and password
API Key: Key value, placement (header, query, body), parameter name, optional prefix
OAuth 2.0: Grant type, client credentials, token URLs, scopes, tokens
Response Mapping
Extracts data from responses into named variables
Variable Name: Name to assign to the extracted value
Data Source: Where to extract data from (body, header, status)
Path Expression: JSONPath (for JSON), XPath (for XML), or header name
Response Format: Format of the response (JSON, XML, text)
Default Value: Fallback if extraction fails
Advanced Settings
Timeout: Maximum seconds to wait for response (1-300, default: 30)
Follow Redirects: Whether to automatically follow HTTP redirects
Maximum Retries: Number of retry attempts for failed requests (0-10)
Output Ports
response_body
(any): Full response bodyAutomatically parsed according to content type
JSON responses are converted to objects/arrays
XML and text responses are returned as strings
Binary responses are base64-encoded
status_code
(int): HTTP response status coderesponse_headers
(object): All response headers as key-value pairserror
(string, optional): Error message if request failedCustom outputs (based on response mappings):
Additional outputs generated from response mapping rules
Types vary based on extracted content
Best Practices
URL Construction
Use complete URLs including protocol (https://)
Consider URL encoding special characters in path segments
For dynamic URLs, use variable interpolation rather than string concatenation
Authentication Security
Store sensitive credentials securely
Use OAuth 2.0 when possible for enhanced security
Avoid embedding credentials directly in URLs
Consider using environment variables for API keys
Error Handling
Configure reasonable timeout values based on expected response time
Set appropriate retry counts for mission-critical requests
Use response mapping default values to handle missing data gracefully
Check status code before processing response data
Response Mapping
Use descriptive variable names that indicate content
Create focused mappings that extract only needed data
Use JSONPath expressions effectively for complex JSON responses
Provide sensible default values for optional fields
Common Issues
Connection Problems
401/403 Errors: Authentication credentials incorrect or missing
Connection Timeout: Target server not responding within timeout period
SSL/TLS Errors: Certificate validation issues
Request Format Issues
400 Bad Request: Malformed request syntax
415 Unsupported Media Type: Incorrect Content-Type header
413 Payload Too Large: Request body exceeds server limits
JSON Parse Errors: Invalid JSON in request body
Response Handling
Path Expression Errors: Incorrect JSONPath or XPath syntax
Missing Fields: Requested fields not present in response
Type Mismatches: Expected data type differs from actual response
Examples
Basic GET Request
URL: https://api.example.com/users
Method: GET
Headers:
- Accept: application/json
Authenticated POST Request with JSON Body
URL: https://api.example.com/data
Method: POST
Headers:
- Content-Type: application/json
Body Format: JSON
Body Content: {"name": "Example", "value": 42}
Authentication Type: API Key
Auth Configuration:
- Key Placement: Header
- Parameter Name: X-API-Key
- Key: your_api_key_here
Response Mapping Example
Variable Name: user_name
Data Source: Response Body
Path Expression: $.data.user.name
Response Format: JSON
Default Value: "Unknown User"
Last updated