Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
AlfredQuick
Frequent Visitor

How to make a GET or POST request in Power Query (public data)

Hello friends,


I am trying to get info into Power BI from a web service that gives different possibilities for the request, SOAP GET and POST:

https://ovc.catastro.meh.es/ovcservweb/OVCSWLocalizacionRC/OVCCallejero.asmx?op=Consulta_DNPRC

In that link, you can see an example of each request type, for example for a GET request the example is:

GET /ovcservweb/OVCSWLocalizacionRC/OVCCallejero.asmx/Consulta_DNPRC?Provincia=string&Municipio=string&RC=string HTTP/1.1
Host: ovc.catastro.meh.es

 
This is public data, so no problems with authentication.How can I do this in Power Query? I need to use the last string (RC) the other ones are optional. If you need anymore info please don't hesitate to ask me for it.

 

Thanks a lot for the help,

Alfred

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

GET requests are done by calling Web.Contents without a Content parameter, POST requests are done by calling Web.Contents with the parameter.

 

GET:

let
    URL = "http://xxx/tstat",
    headers = [#"Content-Type"="application/json"],
    web = Web.Contents(URL, [ Headers = headers, ManualStatusHandling = {404, 400}]),
    result = Json.Document(web),
...

 

POST:

let
    URL = "http://xxx/tstat",
    headers = [#"Content-Type"="application/json"],
    data = Json.FromValue([tmode = 2,t_cool = Setpoint,hold = 0]),
    web = Web.Contents(URL, [ Content = data, Headers = headers, ManualStatusHandling = {404, 400}]),
    result = Json.Document(web),
...

View solution in original post

4 REPLIES 4
AlfredQuick
Frequent Visitor

Thank you very much @lbendlin 

lbendlin
Super User
Super User

GET requests are done by calling Web.Contents without a Content parameter, POST requests are done by calling Web.Contents with the parameter.

 

GET:

let
    URL = "http://xxx/tstat",
    headers = [#"Content-Type"="application/json"],
    web = Web.Contents(URL, [ Headers = headers, ManualStatusHandling = {404, 400}]),
    result = Json.Document(web),
...

 

POST:

let
    URL = "http://xxx/tstat",
    headers = [#"Content-Type"="application/json"],
    data = Json.FromValue([tmode = 2,t_cool = Setpoint,hold = 0]),
    web = Web.Contents(URL, [ Content = data, Headers = headers, ManualStatusHandling = {404, 400}]),
    result = Json.Document(web),
...

Also see https://community.fabric.microsoft.com/t5/Desktop/How-to-run-POST-request-in-M/m-p/457138 for another code adding the Content with empty parameter to Web.Contents call to force Power BI top make a POST request

Content=Text.ToBinary("")

 

Anonymous
Not applicable

This is not working for me. I am trying run a POST API with no paramenters in. Please help if there is nay other solutions.

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors