Power Query连接Channel Advisor API遇400错误/无效客户端问题
Channel Advisor API Power Query 连接问题
- 背景:API纯新手,最初尝试通过Web数据源连接Channel Advisor的令牌接口(
https://api.channeladvisor.com/oauth2/token)失败,改用Excel/Power BI的Power Query工具。 - 已实现的自定义函数:创建了
GetAccessToken函数,可正常获取令牌:
() => let url = "https://api.channeladvisor.com/oauth2/token", headers = [#"Authorization"="Basic xxxxxx"], postBody = [ grant_type = "refresh_token", refresh_token = "xxxxxx" ], response = Json.Document(Web.Contents(url, [ Headers = headers, Content = Text.ToBinary(Uri.BuildQueryString(postBody)) ])), access_token = response[access_token] in access_token
- 遇到的问题:调用上述函数连接订单接口(
https://api.channeladvisor.com/v1/orders)时,出现400错误或返回error | invalid client,查询代码如下:
let Source = Json.Document(Web.Contents("https://api.channeladvisor.com/v1/orders", [Headers=[#"Authorization"="bearer " & GetAccessToken(), #"accept" = "text/plain", #"Content-Type"="application/json"], ManualStatusHandling = {404, 400}])) in Source
- 现状:未找到完整解决指引,后续更新:已在Postman成功连接API,单独通过
GetAccessToken获取的令牌可正常使用;多次重置Power Query权限后,接口突然能返回数据,将继续跟进后续情况。
内容的提问来源于stack exchange,提问作者Dolunaykiz
相关产品推荐
相关产品推荐

