The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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
Solved! Go to Solution.
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),
...
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("")
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.