API Document Loader
API Loader Node
The API Document Loader provides functionality to load and process data from external APIs using HTTP requests. This module enables seamless integration with RESTful APIs and web services.
This module provides a versatile API document loader that can:
- Make HTTP GET and POST requests
- Handle custom headers and request bodies
- Process API responses into documents
- Support JSON data structures
- Customize metadata extraction
- Process responses with text splitters
Inputsβ
Required Parametersβ
- URL: The API endpoint URL to call
- Method: HTTP method to use (GET or POST)
Optional Parametersβ
- Headers: JSON object containing HTTP headers
- Body: JSON object for POST request body
- Text Splitter: A text splitter to process the extracted content
- Additional Metadata: JSON object with additional metadata
- Omit Metadata Keys: Comma-separated list of metadata keys to omit
Outputsβ
- Document: Array of document objects containing metadata and pageContent
- Text: Concatenated string from pageContent of documents
Featuresβ
- HTTP method support (GET/POST)
- Custom header configuration
- Request body customization
- Response processing
- Error handling
- Metadata customization
- Text splitting capabilities
Example Usageβ
GET Requestβ
{
"method": "GET",
"url": "https://api.example.com/data",
"headers": {
"Authorization": "Bearer token123",
"Accept": "application/json"
}
}
POST Requestβ
{
"method": "POST",
"url": "https://api.example.com/data",
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer token123"
},
"body": {
"query": "example",
"limit": 10
}
}
Notesβ
- Supports JSON request/response formats
- Handles HTTP error responses
- Automatically processes response data into documents
- Can be combined with text splitters for content processing
- Supports custom metadata addition and omission
- Error responses are properly handled and reported