{
  "name": "IK-Report-Google-Drive-Example",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "ik-report/documents-generated",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [
        -240,
        -176
      ],
      "id": "8de76471-d09d-4baf-b487-5a9d0d83b5df",
      "name": "Webhook",
      "webhookId": "3c6b30cb-5bd9-4f48-bd27-0ed88e2e4dbe"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "http://host.docker.internal:8080/public/v1/access-token",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBasicAuth",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.4,
      "position": [
        288,
        -176
      ],
      "id": "55f10c53-4f64-430e-be0f-d4b57f0338fa",
      "name": "Get Access Token",
      "credentials": {
        "httpBasicAuth": {
          "id": "1FPkpaXVhfuGHDgU",
          "name": "basic_auth_t2_api_basis"
        }
      }
    },
    {
      "parameters": {
        "fieldToSplitOut": "body.documents",
        "options": {}
      },
      "type": "n8n-nodes-base.splitOut",
      "typeVersion": 1,
      "position": [
        32,
        -176
      ],
      "id": "30c87724-aa3c-42d1-8619-965eedf5efd1",
      "name": "Split Out"
    },
    {
      "parameters": {
        "url": "=http://host.docker.internal:8080/public/v1/generated-documents/{{ $('Split Out').item.json.id }}",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{ $('Get Access Token').first().json.accessToken }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.4,
      "position": [
        528,
        -176
      ],
      "id": "ca33d598-1e33-4f96-b366-052068679ba5",
      "name": "Get Download URIs"
    },
    {
      "parameters": {
        "url": "={{ $json.url }}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.4,
      "position": [
        736,
        -176
      ],
      "id": "ce4069e0-37b9-45e8-88cc-7be011656eee",
      "name": "Download URL"
    },
    {
      "parameters": {
        "name": "={{ $('Split Out').item.json.documentName }}",
        "driveId": {
          "__rl": true,
          "value": "My Drive",
          "mode": "list",
          "cachedResultName": "My Drive",
          "cachedResultUrl": "https://drive.google.com/drive/my-drive"
        },
        "folderId": {
          "__rl": true,
          "value": "1vGOsMxuMJFrKB4sBIgvXLsH0Gvo90PU5",
          "mode": "list",
          "cachedResultName": "IKR-Reports",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1vGOsMxuMJFrKB4sBIgvXLsH0Gvo90PU5"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        944,
        -176
      ],
      "id": "f3eea45c-5dc2-479c-a042-c5485572b283",
      "name": "Upload file",
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "4dFbjPC4A34LHooI",
          "name": "Google Drive account"
        }
      }
    }
  ],
  "pinData": {},
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "Get Access Token",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Access Token": {
      "main": [
        [
          {
            "node": "Get Download URIs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Download URIs": {
      "main": [
        [
          {
            "node": "Download URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download URL": {
      "main": [
        [
          {
            "node": "Upload file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate",
    "availableInMCP": false
  },
  "versionId": "3250ffd3-2969-4146-bf6e-cb26fec4af36",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "310ffef3f91d96710be14ae2de1c3ea0bd9727a4dc3e2fa050bfc9f355ab92fd"
  },
  "nodeGroups": [],
  "id": "HTG0LL97YNIozDWE",
  "tags": []
}
