AutomationFlowsData & Sheets › API Para Banco De Dados

API Para Banco De Dados

API para Banco de Dados. Uses httpRequest, mySql. Scheduled trigger; 4 nodes.

Cron / scheduled trigger★★★★☆ complexity4 nodesHTTP RequestMySQL
Data & Sheets Trigger: Cron / scheduled Nodes: 4 Complexity: ★★★★☆ Added:

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "API para Banco de Dados",
  "nodes": [
    {
      "id": "c3d4e5f6-0003-0003-0003-000000000001",
      "name": "Agendamento Di\u00e1rio",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        240,
        300
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 6 * * *"
            }
          ]
        }
      }
    },
    {
      "id": "c3d4e5f6-0003-0003-0003-000000000002",
      "name": "Buscar Dados da API",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        460,
        300
      ],
      "parameters": {
        "method": "GET",
        "url": "https://api.exemplo.com/v1/registros",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "httpHeaderAuth",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "date",
              "value": "={{ $today.format('YYYY-MM-DD') }}"
            },
            {
              "name": "limit",
              "value": "500"
            }
          ]
        },
        "options": {
          "response": {
            "response": {
              "responseFormat": "json"
            }
          }
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      }
    },
    {
      "id": "c3d4e5f6-0003-0003-0003-000000000003",
      "name": "Transformar Registros",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        680,
        300
      ],
      "parameters": {
        "jsCode": "const registros = $input.first().json.data || [];\n\nreturn registros.map(item => ({\n  json: {\n    id_externo: item.id,\n    nome: item.name || item.nome,\n    valor: parseFloat(item.value || item.valor || 0),\n    status: (item.status || 'pendente').toLowerCase(),\n    categoria: item.category || item.categoria || 'sem_categoria',\n    data_registro: item.created_at || new Date().toISOString(),\n    importado_em: new Date().toISOString()\n  }\n}));"
      }
    },
    {
      "id": "c3d4e5f6-0003-0003-0003-000000000004",
      "name": "Inserir no MySQL",
      "type": "n8n-nodes-base.mySql",
      "typeVersion": 2.4,
      "position": [
        900,
        300
      ],
      "parameters": {
        "operation": "insert",
        "table": {
          "__rl": true,
          "value": "registros_importados",
          "mode": "list"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "id_externo": "={{ $json.id_externo }}",
            "nome": "={{ $json.nome }}",
            "valor": "={{ $json.valor }}",
            "status": "={{ $json.status }}",
            "categoria": "={{ $json.categoria }}",
            "data_registro": "={{ $json.data_registro }}",
            "importado_em": "={{ $json.importado_em }}"
          }
        },
        "options": {
          "replaceEmptyStrings": true
        }
      },
      "credentials": {
        "mySql": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "Agendamento Di\u00e1rio": {
      "main": [
        [
          {
            "node": "Buscar Dados da API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Buscar Dados da API": {
      "main": [
        [
          {
            "node": "Transformar Registros",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Transformar Registros": {
      "main": [
        [
          {
            "node": "Inserir no MySQL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "id": "c3d4e5f6-0003-0003-0003-000000000000",
  "meta": {
    "templateCredsSetupCompleted": false
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

API para Banco de Dados. Uses httpRequest, mySql. Scheduled trigger; 4 nodes.

Source: https://github.com/Rubens-Marques/n8n-flows-library/blob/9226ec20cf7443ed2dad5c84e0f1d5f36651cfd1/flows/dados/api-to-database/flow.json — original creator credit. Request a take-down →

More Data & Sheets workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Data & Sheets

[eliminado] HS Factura. Uses httpRequest, itemLists, mySql. Scheduled trigger; 15 nodes.

HTTP Request, Item Lists, MySQL
Data & Sheets

[Oscar] GetInvoicesFromFapro. Uses httpRequest, mySql. Scheduled trigger; 14 nodes.

HTTP Request, MySQL
Data & Sheets

Ingest Api. Uses httpRequest, mySql. Scheduled trigger; 8 nodes.

HTTP Request, MySQL
Data & Sheets

[Oscar] addNewBusinessLogged. Uses httpRequest, mySql. Scheduled trigger; 8 nodes.

HTTP Request, MySQL
Data & Sheets

MainWorkflow. Uses httpRequest, mySql, emailSend. Scheduled trigger; 8 nodes.

HTTP Request, MySQL, Email Send