{
  "active": false,
  "connections": {
    "Success?": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "HTTP Request1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request1": {
      "main": [
        [
          {
            "node": "Item Lists",
            "type": "main",
            "index": 0
          },
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \"Execute Workflow\"": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Item Lists": {
      "main": [
        [
          {
            "node": "Edit Fields2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields2": {
      "main": [
        [
          {
            "node": "Spreadsheet File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Spreadsheet File": {
      "main": [
        [
          {
            "node": "Write Binary File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code": {
      "main": [
        [
          {
            "node": "Success?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "createdAt": "2023-12-05T10:54:32.169Z",
  "id": "OlkB0SNHIBtQsc39",
  "meta": null,
  "name": "Billbee Aufträge Archiv",
  "nodes": [
    {
      "parameters": {
        "fields": {
          "values": [
            {
              "name": "Id",
              "stringValue": "={{ $json.Id || \"none\" }}"
            },
            {
              "name": "BillbeeId",
              "type": "numberValue",
              "numberValue": "={{ $json.BillBeeOrderId }}"
            },
            {
              "name": "OrderRef",
              "stringValue": "={{ $json.OrderNumber || \"none\" }}"
            },
            {
              "name": "CustomerId",
              "stringValue": "={{ $json.Customer.Number }}"
            },
            {
              "name": "date",
              "stringValue": "={{ $json.CreatedAt }}"
            },
            {
              "name": "Shop",
              "stringValue": "={{ $json.Seller.BillbeeShopName || \"none\" }}"
            }
          ]
        },
        "include": "none",
        "options": {
          "includeBinary": false
        }
      },
      "id": "1fd57f53-0c16-40c6-bb6f-b0dfe3153f87",
      "name": "Edit Fields2",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.1,
      "position": [
        480,
        -1780
      ]
    },
    {
      "parameters": {
        "conditions": {
          "number": [
            {
              "value1": "={{ $json.body.Data }}",
              "operation": "isNotEmpty"
            }
          ]
        }
      },
      "id": "d55390c5-417c-44e0-a7be-0cd4960b30ee",
      "name": "Success?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        300,
        -1340
      ]
    },
    {
      "parameters": {
        "unit": "seconds"
      },
      "id": "5d326db6-a71b-4717-94c2-010ca7911a00",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1,
      "position": [
        680,
        -1360
      ],
      "webhookId": "0c71ff00-b9b2-480b-8034-66d76181e50c"
    },
    {
      "parameters": {
        "url": "https://app.billbee.io/api/v1/orders",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBasicAuth",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "pageSize",
              "value": "250"
            },
            {
              "name": "page",
              "value": "={{ $runIndex + 1 }}"
            },
            {
              "name": "minOrderDate",
              "value": "2022-01-01"
            }
          ]
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "X-Billbee-Api-Key",
              "value": "2855BE2C-1D67-4AB0-9DEB-3073E6D27B1C"
            }
          ]
        },
        "options": {
          "response": {
            "response": {
              "fullResponse": true
            }
          }
        }
      },
      "id": "f39a953a-1fc9-49d3-a8cf-85c6e8dca910",
      "name": "HTTP Request1",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.1,
      "position": [
        -260,
        -1340
      ],
      "credentials": {
        "httpBasicAuth": {
          "id": "xANPcw3p1Nh0wF9J",
          "name": "Unnamed credential"
        }
      }
    },
    {
      "parameters": {},
      "id": "f68bb598-1ee5-4927-aa41-c0d896d7688b",
      "name": "When clicking \"Execute Workflow\"",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        1280,
        -1620
      ]
    },
    {
      "parameters": {
        "fieldToSplitOut": "body.Data",
        "options": {}
      },
      "id": "485ffb0a-09e1-4f63-869c-12e08f3f2b92",
      "name": "Item Lists",
      "type": "n8n-nodes-base.itemLists",
      "typeVersion": 3,
      "position": [
        300,
        -1780
      ]
    },
    {
      "parameters": {
        "fileName": "/var/lib/n8n/foo.csv",
        "options": {
          "append": true
        }
      },
      "id": "62a3101c-53e1-4427-9409-445192661b24",
      "name": "Write Binary File",
      "type": "n8n-nodes-base.writeBinaryFile",
      "typeVersion": 1,
      "position": [
        960,
        -1780
      ]
    },
    {
      "parameters": {
        "operation": "toFile",
        "fileFormat": "csv",
        "options": {
          "headerRow": false
        }
      },
      "id": "d3884621-003c-402f-916b-422769a31501",
      "name": "Spreadsheet File",
      "type": "n8n-nodes-base.spreadsheetFile",
      "typeVersion": 2,
      "position": [
        720,
        -1780
      ]
    },
    {
      "parameters": {
        "jsCode": "// Loop over input items and add a new field called 'myNewField' to the JSON of each one\nfor (const item of $input.all()) {\n  if (item.json.body.Data.length === 0) {\n    item.json.headers.statusCode = 400;\n}\n}\n\nreturn $input.all();"
      },
      "id": "45397e03-e683-464b-81f1-b072f243d0e1",
      "name": "Code",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        60,
        -1340
      ]
    },
    {
      "parameters": {},
      "id": "670fa20b-31ff-49f4-9312-af0c282ce2c7",
      "name": "No Operation, do nothing",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        500,
        -1120
      ]
    }
  ],
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null,
  "tags": [],
  "triggerCount": 0,
  "updatedAt": "2023-12-06T14:46:22.000Z",
  "versionId": "babad15a-e25b-4d55-88d5-b8d00b99104b"
}