cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
ldroguett Frequent Visitor
Frequent Visitor

API REST METHOD POST

Hello friends, hoping you are well.
I have an api rest that can only be called by the methodo post and in Power BI Desktop I have no problems, but when wanting to have an updated programming in service I have problems.

 

 

This is my advanced editor to consume the api.

let
fechaI = Date.ToText(DateTime.Date(DateTime.LocalNow()),"yyyy-MM-dd'T'HH:mm:ss"),
fechaT = Replacer.ReplaceText(fechaI,"T00:00:00","T23:59:59"),
url = "url api",
body = "{""apiKey"":""api key"", ""inicio"":"""&fechaI&""", ""termino"":"""&fechaT&""", ""identificador"": null}",
Source = Json.Document(Web.Contents(url,[
Headers = [#"Content-Type"="application/json"],
Content = Text.ToBinary(body)
]
)),
in
Source

 

Then he asks me for a web credential where I can put Anonymous and make it public.

Sin título.png

So far so good.

 

Then I publish my report but when I want to have a scheduled update, I have that error.

 

sdds.png

 

 

 

dddddddddd.png

I already tried installing and reviewing my gateway and nothing please help.!!!!!!!!!!!!!!!!!!!!!!!!

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: API REST METHOD POST

Hi @ldroguett ,

It seems like detail REST API url not allow you to use anonymous authorizations on it. If this is a case, I'd like to suggest you to add relative path option to convert rest api url to root path and relative path.

let
	Source=Web.Contents("https://xxxx.xxxxxxx.com",[Headers = [#"Content-Type"="application/json"],Content = Text.ToBinary(body),RelativePath="/api/xxxxxxx"])
in
	Source

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, please consider Accept it as the solution to help the other members find it more quickly
Learning resources: Power BI

View solution in original post

2 REPLIES 2
Community Support Team
Community Support Team

Re: API REST METHOD POST

Hi @ldroguett ,

It seems like detail REST API url not allow you to use anonymous authorizations on it. If this is a case, I'd like to suggest you to add relative path option to convert rest api url to root path and relative path.

let
	Source=Web.Contents("https://xxxx.xxxxxxx.com",[Headers = [#"Content-Type"="application/json"],Content = Text.ToBinary(body),RelativePath="/api/xxxxxxx"])
in
	Source

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, please consider Accept it as the solution to help the other members find it more quickly
Learning resources: Power BI

View solution in original post

ldroguett Frequent Visitor
Frequent Visitor

Re: API REST METHOD POST

Thanks ! 

Helpful resources

Announcements
Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors
Top Kudoed Authors