【问题标题】:Power Query API Call POST Method - Bearer tokenPower Query API 调用 POST 方法 - 不记名令牌
【发布时间】:2020-10-23 21:47:19
【问题描述】:

我在使用 Power Query 连接到带有 Power B.I 的 API 时遇到问题,我不太了解语法。

一开始我尝试了这个方法,但是失败了,因为这个API的方法是POST。

let
  Source = Json.Document(Web.Contents("https://URL", [Headers=[Authorization="Bearer XXX"]])),
  #"Converted to Table" = Record.ToTable(Source),
  #"Expanded Value" = Table.ExpandListColumn(#"Converted to Table", "Value"),
  #"Expanded Value1" = Table.ExpandRecordColumn(#"Expanded Value", "Value", {"id", "name", "isoCode", "treeId"}, {"Value.id", "Value.name", "Value.isoCode", "Value.treeId"})
in
  #"Expanded Value1"

我也试过

let
    body = [{id="2", iso="be", name="be"}],
    AccessTokenList = List.Buffer(api_token),
    access_token = AccessTokenList{0},
    AuthKey = "Bearer XXX" & access_token,
    url = "URL",
    Response = Web.Contents(url, [Headers=[Authorization=AuthKey, ContentType="application/json", Accept="application/json"], Content=Text.ToBinary(body)]),
    JsonResponse = Json.Document(Response)
in
    Response

但我仍然没有任何好的结果。有人可以指导我使用 Power Query 吗?

谢谢!

【问题讨论】:

    标签: api post powerbi powerquery m


    【解决方案1】:

    这是文档中的

    示例请求 curl -H '授权:承载 TOKEN' -H '内容类型:application/json' -X POST 'https://URL' 示例响应

    [
    {
    "name": "Belgium",
    "iso": "be",
    "id": 2,
    "marketNodeTypes": [
    {
    "marketNodeTypePK": {
    "nodeType": "aggregate"
    },
    "privilegeId": 209
    },
    {
    "privilegeId": 208,
    "marketNodeTypePK": {
    "nodeType": "application"
    }
    },
    {
    "privilegeId": 207,
    "marketNodeTypePK": {
    "nodeType": "domain"
    }
    },
    {
    "marketNodeTypePK": {
    "nodeType": "group"
    },
    "privilegeId": 206
    }
    ]
    }
    ]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-10-15
      • 2019-08-08
      • 1970-01-01
      • 1970-01-01
      • 2018-02-28
      • 2013-09-03
      • 2017-11-04
      • 1970-01-01
      相关资源
      最近更新 更多