首页 > 解决方案 > 循环 Power BI API 调用以提取未知数量的记录以避免速率限制?

问题描述

我正在尝试连接到 Palo Alto 的 Cortex XDR,以将事件拉入 Power BI 以分析平均解决时间、每位分析师的总数等。 

我能够验证并提取最后 100 个事件。根据文档,每次查询无法提取超过 100 个。 

这是正在运行的查询。 

let
    body = "{ ""request_data"": {}}",
    GetJson = Web.Contents("https://api-{company}.xdr.us.paloaltonetworks.com/public_api/v1/incidents/get_incidents/",
        [  
            Headers = [#"Content-Type" = "application/json",
                #"x-xdr-auth-id" = "{API ID}",
                #"Authorization" = "{API KEY}"
            ],
            Content = Text.ToBinary(body)
        ]
    ),
    FormatAsJson = Json.Document(GetJson),
    #"Converted to Table" = Record.ToTable(FormatAsJson),
    Value = #"Converted to Table"{0}[Value],
    incidents = Value[incidents],
    Result = Table.FromRecords(incidents)
in
    Result

 在查看文档时,我注意到它有一种方法可以查询特定范围的事件(不超过 100 个)并尝试将其插入但无法提取指定的事件。 

有没有办法在不知道总数的情况下循环 API 拉取所有事件(将不断增加)?

标签: apipowerbipowerquery

解决方案


推荐阅读