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,270 points
732 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,490 points

Related Questions In Power BI

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
• 37,580 points
31 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,270 points
94 views
0 votes
1 answer

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 in Power BI by Cherukuri
• 17,890 points
1,517 views
0 votes
1 answer

Is there a way to convert JSON data to readable table in power bi

Follow these steps step 1 - Click on ...READ MORE

answered Sep 24, 2018 in Power BI by Hannah
• 14,080 points
1,666 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,190 points
122 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 in Power BI by Upasana
• 8,490 points
17 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 in Power BI by Shubham
• 13,270 points
51 views
0 votes
1 answer

Retrieve epay.info Balance with VBA and Excel

This code should log you in, provided ...READ MORE

answered Sep 5, 2018 in Blockchain by digger
• 27,620 points
35 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 in Power BI by Upasana
• 8,490 points
51 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 in Power BI by Upasana
• 8,490 points
119 views