{
  "name": "ApiSkills — Capstone: OAuth2 + Paginate + Flatten",
  "nodes": [
    {
      "parameters": {},
      "id": "trigger-capstone",
      "name": "When clicking Test workflow",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [0, 0]
    },
    {
      "parameters": {
        "url": "https://api.aiwf.in/playground/data/stocks/candles",
        "authentication": "genericCredentialType",
        "genericAuthType": "oAuth2Api",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            { "name": "shape", "value": "flat" },
            { "name": "page_size", "value": "50" }
          ]
        },
        "options": {
          "pagination": {
            "pagination": {
              "paginationMode": "responseContainsNextURL",
              "nextURL": "={{ $response.body.pagination.next }}",
              "paginationCompleteWhen": "other",
              "completeExpression": "={{ $response.body.pagination.next === null }}",
              "limitPagesFetched": true,
              "maxRequests": 20
            }
          }
        }
      },
      "id": "http-capstone",
      "name": "HTTP Request (OAuth2 + paginate)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [240, 0]
    },
    {
      "parameters": {
        "fieldToSplitOut": "data",
        "options": {}
      },
      "id": "split-capstone",
      "name": "Split Out (flatten rows)",
      "type": "n8n-nodes-base.splitOut",
      "typeVersion": 1,
      "position": [480, 0]
    }
  ],
  "connections": {
    "When clicking Test workflow": {
      "main": [[{ "node": "HTTP Request (OAuth2 + paginate)", "type": "main", "index": 0 }]]
    },
    "HTTP Request (OAuth2 + paginate)": {
      "main": [[{ "node": "Split Out (flatten rows)", "type": "main", "index": 0 }]]
    }
  },
  "settings": {},
  "meta": {
    "apiskills": "The capstone: authenticate via OAuth2 client credentials, paginate all stock candles by following pagination.next, then Split Out the `data` array into individual rows ready to load into a Sheet/DB. Replace api.aiwf.in with your API domain."
  }
}
