Overview
This node, named "Generic API," is designed to integrate with any RESTful API by allowing users to specify the resource and operation they want to perform. It supports common CRUD operations such as creating, retrieving, updating, and deleting records on a specified API resource.
The "Atualizar" (Update) operation specifically updates an existing record identified by its ID with new data provided in JSON format. This is useful when you need to modify existing entries in an external system via its API.
Practical example:
If you have a CRM system exposing a REST API, you can use this node to update contact information by specifying the resource as "contacts," the operation as "update," the contact's ID, and the updated data in JSON format.
Properties
| Name | Meaning |
|---|---|
| ID | The unique identifier of the record to update. |
| Dados Para Atualizar | JSON-formatted data containing the fields and values to update in the record. |
| Opções Adicionais | Additional options for the request: |
| - Headers Customizados | Custom HTTP headers to include in the API request. |
| - Query Parameters | Additional query parameters to append to the URL. |
| - Timeout | Request timeout in milliseconds (default 30000 ms). |
| - Continuar Em Erro | Whether to continue workflow execution if an error occurs during this operation (boolean). |
Output
The node outputs the response from the API call in the json field of each item. If the API returns multiple items (an array), each item is output separately paired with the input item index.
- The output JSON structure corresponds directly to the API's response after updating the record.
- No binary data output is produced by this node.
Dependencies
- Requires an API key or authentication token credential configured in n8n to authorize requests to the target API.
- Uses a helper class internally to make HTTP requests (
GenericApiHelpers). - The user must provide the base resource name and operation type.
- Supports custom headers and query parameters for flexible API interaction.
Troubleshooting
Common issues:
- Invalid or missing ID: The update operation requires a valid record ID; ensure it is correctly provided.
- Malformed JSON in "Dados Para Atualizar": The update data must be valid JSON; syntax errors will cause failures.
- API authentication errors: Ensure the API credentials are correctly set up and have permission to update records.
- Timeout errors: If the API is slow to respond, consider increasing the timeout value in additional options.
Error handling:
- If "Continuar Em Erro" is false (default), the node will throw an error and stop workflow execution on failure.
- If "Continuar Em Erro" is true, errors are caught and returned as JSON objects with an
errormessage and optional details, allowing the workflow to continue.
Links and References
- n8n Documentation on Creating Nodes
- General REST API concepts: https://restfulapi.net/