Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
FoxEddy
Frequent Visitor

How to pull Qualys vulnerability detection data with pagination?

With the the help from suggestions in the community, I managed to pulled Qualys VM data. While since there are too many records, in some scenarios I always failed. There are two options I have in mind:

1. paginated report, pull certain numbers of asset vulnerability records at a time, and repeat till all are fetched.

2. incremental refresh.

 

Currently, I'm trying with #1, paginated report, while I tried and failed... Can someone please help? Thanks a lot.

 

let
// 设置参数
apiUrl = "https://qualysapi.qualys.com/api/2.0/fo/asset/host/vm/detection/?action=list&severities=3&show_resul...",
headers = [Authorization="Basic xx", #"X-Requested-With"="Test"],

// 定义获取数据的函数
GetData = (url) =>
let
source = Xml.Tables(Web.Contents(url, [Headers=headers])),
// 从XML数据中提取有用的信息,具体步骤取决于返回的XML结构
data = source{0}[HOST_LIST] // 使用正确的节点名称
in
data,

// 获取第一页数据
firstPageUrl = apiUrl,
firstPageData = GetData(firstPageUrl),

// 初始化变量
allPagesData = {firstPageData},
nextPageUrl = try Xml.Tables(Web.Contents(firstPageUrl, [Headers=headers])){0}[HOST_LIST]{0}[URL] otherwise null,

// 定义递归函数
GetNextPageData = (url as text, accumData as list) =>
let
pageData = GetData(url),
newAccumData = accumData & {pageData},
newNextPageUrl = try Xml.Tables(Web.Contents(url, [Headers=headers])){0}[HOST_LIST]{0}[URL] otherwise null
in
if newNextPageUrl <> null then
GetNextPageData(newNextPageUrl, newAccumData) // 此处使用了不同的变量名
else
newAccumData,

// 调用递归函数以获取剩余页数的数据
allPagesDataResult = GetNextPageData(nextPageUrl, allPagesData)

// 将所有数据转换为表格
// resultTable = Table.FromList(List.Combine(allPagesDataResult), Splitter.SplitByNothing())
in
allPagesDataResult

1 REPLY 1
FoxEddy
Frequent Visitor

Anyone knows about this? Really appreciate.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.