Power Query http POST request with form data

0 votes

So, there's REST API I have, which accepts only POST requests with form data.

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

let
    url = "https://example.com",
    body = "{ ""first_param"": ""AAAAA"",  ""second_param"": ""BBBBBB""}",    

    Source = Json.Document(Web.Contents(url,[ Headers = [#"Content-Type"="application/json"], Content = Text.ToBinary(body) ] ))
in
    Source

So my question is that Is it possible to send form data?? and How?

Thanks.

Dec 12, 2018 in Power BI by Shubham
• 13,490 points
8,288 views

1 answer to this question.

0 votes

Try using Uri.BuildQueryString and Json.Document.

let
    url = "https://example.com",
    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(body) ] ))
in
    Source

Hope this helps!

answered Dec 12, 2018 by Upasana
• 8,620 points
yes this worked. Thank you

Related Questions In Power BI

0 votes
0 answers
0 votes
1 answer

Integrate Google Analytics data with Power BI data

When you use standard google analytics connector ...READ MORE

answered Oct 3, 2018 in Power BI by Kalgi
• 52,360 points
606 views
0 votes
1 answer

Power Query Web request results in “CR must be followed by LF” Error

What I think is, it might look ...READ MORE

answered Oct 29, 2018 in Power BI by Shubham
• 13,490 points
1,555 views
+2 votes
3 answers

How to replace null values with custom values in Power BI(power query editor)?

Hi Nithin, To fill or replace the null or ...READ MORE

answered Mar 8, 2019 in Power BI by Cherukuri
• 33,030 points
152,443 views
0 votes
1 answer

Excel Power Query: Using List.MatchAny on a column value

try this. let TableA = ...READ MORE

answered Oct 22, 2018 in Power BI by Annie97
• 2,160 points
3,789 views
0 votes
1 answer

Power Query : Adding Columns and Multiple files

The following call, FirstRowAsHeader = Table.PromoteHeaders(TableWithoutHeader) shall replace the ...READ MORE

answered Feb 14, 2019 in Power BI by Upasana
• 8,620 points
1,421 views
0 votes
1 answer

PowerQuery : How can I reference a cell's value?

You can do so using a named ...READ MORE

answered Feb 27, 2019 in Power BI by Shubham
• 13,490 points
18,768 views
0 votes
1 answer

Format Data to tabular structure in Excel - Power m Query - Excel

Hi, @Kiranbvsn You can check this out: https://www.howtoexcel.org/ ...READ MORE

answered Oct 27, 2020 in Power BI by Gitika
• 65,910 points
433 views
0 votes
1 answer

Power Query : making HTTP POST request with form data

Try Using Uri.BuildQueryString and Json.Document let ...READ MORE

answered Feb 14, 2019 in Power BI by Upasana
• 8,620 points
5,629 views
0 votes
1 answer

Cumulative row data over last 12 months in Power Query

Basically, what you do is,  Add an Index,  Group ...READ MORE

answered Apr 1, 2019 in Power BI by Upasana
• 8,620 points
2,632 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP