Power Query,使用表单数据发出http POST请求

编程入门 行业动态 更新时间:2024-10-22 23:34:27
本文介绍了Power Query,使用表单数据发出http POST请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个REST API,该API仅接受带有表单数据的POST请求.

I have a REST API, which accepts only POST requests with form data.

我知道在Power Query中,JSON请求是这样的:

I know that in Power Query JSON requests are like this:

let url = "example", body = "{ ""first_param"": ""AAAAA"", ""second_param"": ""BBBBBB""}", Source = Json.Document(Web.Contents(url,[ Headers = [#"Content-Type"="application/json"], Content = Text.ToBinary(body) ] )) in Source

如何发送表格数据?

推荐答案

使用Uri.BuildQueryString和Json.Document

let url = "example", body = "{ ""first_param"": ""AAAAA"", ""second_param"": ""BBBBBB""}", Parsed_JSON = Json.Document(body), BuildQueryString = Uri.BuildQueryString(Parsed_JSON), Source = Json.Document(Web.Contents(url,[Headers = [#"Content-Type"="application/json"], Content = Text.ToBinary(BuildQueryString) ] )) in Source

顺便说一句,您最好将 body 直接构造为 record ,避免使用文本字符串和双引号的双引号)

btw, you'd better construct body directly into a record, avoiding text string and double of double quotes )

更多推荐

Power Query,使用表单数据发出http POST请求

本文发布于:2023-06-05 19:40:18,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/526458.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:表单   数据   Query   Power   http

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!