【问题标题】:Schedule refresh not working for web.contents based query计划刷新不适用于基于 web.contents 的查询
【发布时间】:2020-07-03 10:44:45
【问题描述】:

这是我尝试使用来自“VMware vRealize Automation API”的 web.contents 查询获取令牌数据时收到的消息:

处理数据集中的数据时出错。 请稍后再试或联系支持人员。如果您联系支持人员,请提供这些详细信息。 数据源错误

{"error":{"code":"ModelRefresh_ShortMessage_ProcessingError","pbi.error":{"code":"ModelRefresh_ShortMessage_ProcessingError","parameters": {},"details":[{"code":"Message","detail":{"type":1,"value":"Web.Contents 未能从 'https://xxxxxxxxx.com/identity/api/tokens' 获取内容 (404): 未找到"}}],"exceptionCulprit":1}}}

表:GetToken。

传递给Web.Contents的第一个参数(authUrl = "https://xxxxxxxxx.com/identity/api/tokens")的url是可访问的,但总是返回HTTP ERROR 405,可能 因为此 API 在请求正文参数中使用 JSON 对象和用户凭据来获取响应。

API

我的查询

【问题讨论】:

    标签: api powerbi


    【解决方案1】:

    主要问题:

    1. 您的 API 使用 HTTP POST 而不是 GET,因此您需要设置 Options[Content]
    2. 除非您使用Options[RelativePath],否则您可能会在服务上出现刷新错误
    3. 您可以“选择加入”处理特定 HTTP 状态代码的错误,结合Value.MetaData,您可以获得更详细的错误消息。
    4. 通过使用QueryContent 参数,让它从records 和lists 为您生成JSON,请参阅:docs: Web.Contents

    这相当于你的curl POST 请求

    let
        BaseUrl = "https://www.example.com",
        Options = [
            RelativePath = "/identity/api/tokens",
            Headers = [
                Accept="application/json"
            ],
            Content = [
                username = "username",
                password = "password",
                tenant = "tenant"
            ],
            ManualStatusHandling = {400, 405}
        ],
        // wrap 'Response' in 'Binary.Buffer' if you are using it multiple times
        response = Web.Contents(BaseUrl, Options),
        buffered = Binary.Buffer(response),
        response_metadata = Value.Metadata(response),
        status_code = response_metadata[Response.Status],
        from_json = Json.Document(final_result)
    in
        from_json
    

    我在这里有相关的Web.Contents 示例,例如链接Web.Contents 请求:ninmonkeys.com/Power-Query-Custom-Functions-Cheat-Sheet

    【讨论】:

      猜你喜欢
      • 2020-01-11
      • 1970-01-01
      • 2023-04-01
      • 1970-01-01
      • 2023-01-16
      • 2014-04-05
      • 1970-01-01
      • 2021-07-22
      • 1970-01-01
      相关资源
      最近更新 更多