Forum Discussion
Query contains unsupported function. Function name: Web.Contents for web API
Hi osandrolucas
It looks that you should change your relative path.
I see that parameter "06-2020" is a part of your relative path.
So the proper relative path should be:
RelativePath = "/colaborador/demitidos/06-2020",
In your function I see that you don't need "Query" part.
Query would be when you have additional parameters after "?" sign in your URL.
For example I have: https://xxxx.xxxx.net/Test/v3?page=2&pageSize=10000 (& all my parameters from the "Query")
And you don't have that: http://folha-pagamento-facade-corporativo.agibank-prd.in/colaborador/demitidos/06-2020
Hi Everyone Anonymous Anonymous osandrolucas kleroy my_bi_quest @
I having the Same issue with the Oauth REST API. It is perfectly working in the Powe Bi desktop and refreshes as well. But when i Publish to the Bi server, A dataset is generated Automaticall and generating an error. The error is listed below.
"You can't schedule refresh for this dataset because the following data sources currently don't support refresh:
- Data source for Query1
Query contains unsupported function. Function name: Web.Contents "
My M Query is:
let
token_url = "https://api.example.com/v2/oauth/token",
//This is for Dynamic Date filter of last 2 day which i have used in api base url
endDate = Date.From( DateTime.LocalNow() ),
startDate = Date.AddDays( endDate , -2 ),
startDateText = Date.ToText( startDate, "yyyy-MM-ddT01" ),
endDateText = Date.ToText( endDate, "yyyy-MM-ddT23" ),
api_base_url = "https://openapi.example.com/api/reporting-details/v2/prod/views/PurchaseOrders?realm=myrealm&filters=%7B%22createdDateFrom%22%3A%22"& startDateText &"%3A00%3A00Z%22%2C%22createdDateTo%22%3A%22"&endDateText&"%3A59%3A59Z%22%7D",
qry_str = "?myparameter",
// Getting Oauth Access Token
body="grant_type=openapi_2lo",
Source = Json.Document(Web.Contents(token_url,
[
Headers = [
#"Content-Type"="application/x-www-form-urlencoded",
#"Authorization"="Basic Tyuek938nrkdtoo439nrhyeojgwpddam2ie6gsd8wokf08ugdiwjjtAOp73hwusb"
],
Content=Text.ToBinary(body)
])),
token = Source[access_token],
// Oauth Token Section Ended
// Getting Data From Api
data= Json.Document(Web.Contents(api_base_url&qry_str,
[
Headers = [
#"Authorization"="Bearer "&token,
#"Content-Type"="application/json",
#"apiKey"="845RCEJTL63884jlkjaellT77kwnn"
]
])),
Records = data[Records],
#"Converted to Table" = Table.FromList(Records, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
//Alot of lines removed , Conversion to tabular form.
in
#"Renamed Columns"
I have also replaced the url varibales with a string but i don't know what exactly the problem is. I am tired of this problem.
Any help will be really appreciated.
Thanks in advance.