{
  "name": "Save Qualys reports to TheHive",
  "nodes": [
    {
      "id": "f97d8638-b081-4b09-9a83-265f8f99d2dc",
      "name": "When clicking \"Test workflow\"",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        460,
        400
      ]
    },
    {
      "id": "2df27d6b-b89b-4af0-bdbf-4bc1e0dfc95a",
      "name": "Global Variables",
      "type": "n8n-nodes-base.set",
      "position": [
        780,
        460
      ]
    },
    {
      "id": "f280aaec-10e1-4d4f-9233-75130f7e2601",
      "name": "Fetch Reports from Qualys",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1180,
        460
      ]
    },
    {
      "id": "481066cc-8ac2-4382-9203-33b78f76af77",
      "name": "Remove Already Processed Reports",
      "type": "n8n-nodes-base.filter",
      "position": [
        1700,
        460
      ]
    },
    {
      "id": "4dfdb8c9-ab22-48a4-ada0-d1edd30b9460",
      "name": "Any Reports to Process?",
      "type": "n8n-nodes-base.if",
      "position": [
        1880,
        460
      ]
    },
    {
      "id": "94e678e8-669f-47ee-9530-4652ff11b99f",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        2120,
        520
      ]
    },
    {
      "id": "28dc3495-5af2-4b31-ac20-a3c7ee11f19f",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        2380,
        540
      ]
    },
    {
      "id": "06e5daf2-334a-430e-8dbf-c8feeb20d015",
      "name": "Update Timestamp",
      "type": "n8n-nodes-base.n8n",
      "position": [
        2380,
        380
      ]
    },
    {
      "id": "387c0d2a-09e0-4227-8910-f0a30106787a",
      "name": "Get Last Timestamp",
      "type": "n8n-nodes-base.executeWorkflow",
      "position": [
        980,
        460
      ]
    },
    {
      "id": "6c0d8608-da13-4fa1-a612-aa43ac607af6",
      "name": "XML",
      "type": "n8n-nodes-base.xml",
      "position": [
        1340,
        460
      ]
    },
    {
      "id": "511d290e-5cad-4d34-b54c-de45b11dab45",
      "name": "Split Out",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1520,
        460
      ]
    },
    {
      "id": "45f7c06b-63c0-4bae-b301-33633e751a61",
      "name": "Create Case",
      "type": "n8n-nodes-base.theHiveProject",
      "position": [
        2640,
        540
      ]
    },
    {
      "id": "b38d3176-2c87-4460-b22c-e08ccae93e44",
      "name": "Download Report",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3060,
        540
      ]
    },
    {
      "id": "9b005b38-be40-4f36-954e-ef829b894436",
      "name": "Add Report As Attachment",
      "type": "n8n-nodes-base.theHiveProject",
      "position": [
        3420,
        540
      ]
    },
    {
      "id": "8a1fda04-2028-41a0-95db-3aa958fc7446",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        460,
        560
      ]
    },
    {
      "id": "25f91441-f95a-4da8-9d62-acecc22b6789",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2920,
        164.82441481723265
      ],
      "parameters": {
        "width": 361.5043838490178,
        "height": 550.0452010151306,
        "content": "![Qualys](https://uploads.n8n.io/templates/qualys.png)\nCreate a new case in TheHive\nIn this section, we create a new case in TheHive as a container for our PDF report. The case must be created first t"
      }
    },
    {
      "id": "3f84b5c8-4f1c-4dc9-a9ce-8f8936bfbf98",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1140,
        20
      ],
      "parameters": {
        "width": 318.2931356227883,
        "height": 698.5851033452675,
        "content": "![Qualys](https://uploads.n8n.io/templates/qualys.png)\n## Fetch reports from Qualys\nFor more information about this endpoint, visit the [API quick reference](https://cdn2.qualys.com/docs/qualys-api-qu"
      }
    },
    {
      "id": "a3843690-484f-4ff4-b47b-1b8fc76e93de",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        320,
        20
      ],
      "parameters": {
        "width": 400.5192406950739,
        "height": 694.6109995985548,
        "content": "![scheduled](https://uploads.n8n.io/templates/scheduled.png)\n## Run every hour\nThe first time the workflow runs, no timestamp will exist in the subworkflow, so it will query all the Qualys scans to ge"
      }
    },
    {
      "id": "21c4c9ae-203d-480e-8459-c36726d57d92",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        720,
        20
      ],
      "parameters": {
        "width": 400.5192406950739,
        "height": 696.1026552732698,
        "content": "![n8n](https://uploads.n8n.io/templates/n8n.png)\n## Set time Stamp\nTo ensure we do not duplicate data in TheHive, we set a timestamp like a bookmark for every time we run this workflow. We then use th"
      }
    },
    {
      "id": "ef250f59-304d-4710-80e8-e8e81e4a4f68",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1460,
        20
      ],
      "parameters": {
        "width": 1067.9843739266996,
        "height": 696.1026552732698,
        "content": "![n8n](https://uploads.n8n.io/templates/n8n.png)\n## Split out all reports to ensure they are all processed. \nWhen we get the response from Qualys, multiple reports are embedded in the JSON, so we use "
      }
    },
    {
      "id": "3dff5dc9-95a6-48f5-aee7-d839a385578f",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2540,
        160.4112877153152
      ],
      "parameters": {
        "width": 361.5043838490178,
        "height": 554.458328117048,
        "content": "![TheHive](https://uploads.n8n.io/templates/thehive.png)\n## Create a new case in TheHive\nIn this section, we create a new case in TheHive as a container for our PDF report. The case must be created fi"
      }
    },
    {
      "id": "5509f907-e2bb-4045-864e-283d3da5d5ce",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3300,
        200
      ],
      "parameters": {
        "width": 361.5043838490178,
        "height": 514.8696158323633,
        "content": "![TheHive](https://uploads.n8n.io/templates/thehive.png)\nHere we attach the PDF file as an attachment to the Case in TheHive. \n\nThis step automates the attachment of the downloaded report to the creat"
      }
    },
    {
      "id": "d0a7d953-91de-448b-adfb-72d8c52b9efe",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -340,
        20
      ],
      "parameters": {
        "width": 646.7396383244529,
        "height": 1327.6335333503064,
        "content": "![n8n](https://uploads.n8n.io/templates/n8n.png)\n\n# Automate Report Generation with n8n & Qualys\n\n## Introducing the Save Qualys Reports to TheHive Workflow—a robust solution designed to automate the "
      }
    }
  ],
  "connections": {
    "XML": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Create Case",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "Remove Already Processed Reports",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Case": {
      "main": [
        [
          {
            "node": "Download Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Report": {
      "main": [
        [
          {
            "node": "Add Report As Attachment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Update Timestamp",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Global Variables": {
      "main": [
        [
          {
            "node": "Get Last Timestamp",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Global Variables",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Last Timestamp": {
      "main": [
        [
          {
            "node": "Fetch Reports from Qualys",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Any Reports to Process?": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Update Timestamp",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add Report As Attachment": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Reports from Qualys": {
      "main": [
        [
          {
            "node": "XML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \"Test workflow\"": {
      "main": [
        [
          {
            "node": "Global Variables",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Remove Already Processed Reports": {
      "main": [
        [
          {
            "node": "Any Reports to Process?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}