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,772 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

After connecting SharePoint List with Power BI, and editing data in query, all the data I want are in links

I've try so many ways to decode ...READ MORE

Jun 18, 2020 in Power BI by Dora
• 120 points
1,170 views
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,350 points
824 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,886 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
159,810 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
4,251 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,707 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
19,530 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,770 points
676 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
6,098 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
3,135 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