Overview
This node fetches news data from an external API by constructing a URL with a user-defined base API URL, a query parameter name, and a search string. It sends a GET request to the constructed URL, retrieves the JSON response, and outputs the full result directly. This node is useful for workflows that need to integrate real-time news retrieval based on dynamic search terms, such as monitoring news about specific topics, locations, or events.
Practical examples:
- Fetching the latest news headlines about a city or region.
- Searching for news articles related to a particular company or event.
- Integrating news updates into dashboards or alert systems.
Properties
| Name | Meaning |
|---|---|
| API URL | The base URL of the news API endpoint to query. |
| Search Parameter Name | The name of the query parameter in the API URL used to pass the search string (e.g., "q"). |
| News Search String | The text string to send as the search query to the API (e.g., "El Universal Cartagena"). |
Output
The node outputs an array with one item containing a json object structured as follows:
requestUrl: The base API URL used for the request.queryString: The search string sent to the API.toolName: A fixed identifier string"obtener_noticias_eu".apiResult: The full JSON response returned by the external news API.status: A string indicating success, always"success"if no error occurred.
The output does not include binary data; it solely returns JSON data representing the news API response.
Dependencies
- Requires internet access to call the specified external news API.
- No special credentials are required by default, but the API URL must be accessible and valid.
- Uses the standard
fetchAPI for HTTP requests. - No additional n8n credentials or environment variables are needed unless the API requires authentication (not indicated here).
Troubleshooting
Common issues:
- Invalid or unreachable API URL will cause HTTP errors.
- Incorrect search parameter name may lead to unexpected or empty results.
- Network connectivity problems can prevent successful API calls.
Error messages:
- If the HTTP response status is not OK (non-2xx), the node throws an error including the HTTP status code, status text, and response body.
- If the fetch operation fails (e.g., network error), the node logs the error and throws a descriptive message indicating failure to get news for the given search string.
Resolution tips:
- Verify the API URL is correct and accessible.
- Confirm the search parameter name matches the API's expected query parameter.
- Check network connectivity and proxy settings if applicable.
- Review the API documentation for any required headers or authentication if errors persist.
Links and References
- Fetch API Documentation
- Example news API (as per default): El Universal Most Read News API (Note: verify actual API docs for usage details)