Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago

Scheduled refresh for reports based on API

I made report using data gathered from API's. When I tried to publish report and set up scheduled refresh in web service I got unsupported data source error. After couple sessions in google I found the workaround and was able to set scheduled refresh (splitting URL in base URL that gives status 200 and putting rest of the URL in RelativePath). So all good BUT

When I try to publish same report in Report Server this workaround does not work, I am prompted to enter credentials, when I choose Anonymous than this error follows:

The report server couldn't connect to the data source using the information you entered. Make sure you've entered the connection string and any credentials correctly.

 

When I check in Fiddler this is what I see:

POST /Reports/api/v2.0/PowerBIReports(some_hex_string I_better_remove)/Model.CheckDataSourceConnection HTTP/1.1 gets status 401

POST /Reports/api/v2.0/PowerBIReports(some_hex_string I_better_remove)/Model.CheckDataSourceConnection HTTP/1.1 gets status 200

EDIT:

Second request gets response:

HTTP/1.1 200 OK
Cache-Control: no-cache
Content-Length: 197
Content-Type: application/json; odata.metadata=minimal
Server: Microsoft-HTTPAPI/2.0
X-Content-Type-Options: nosniff
Set-Cookie: XSRF-NONCE=some_string_I_better_delete; path=/Reports; HttpOnly
Set-Cookie: XSRF-TOKEN=deprecated; path=/Reports
OData-Version: 4.0
WWW-Authenticate: some_long_string_I_better-delete
Date: Mon, 10 Dec 2018 11:48:59 GMT

{
  "@odata.context":"http://report_server_address/Reports/api/v2.0/$metadata#Model.DataSourceCheckResult","IsSuccessful":false,"ErrorMessage":"Log on failed. Ensure the user name and password are correct."
}



Why this is not working with Report Server while it works with app.powerbi.com?
Is there any way to make it work?
Do I need to provide something more from Fiddler?

Thanks in advance!

EDIT2:

This is workaround I used for app.powerbi.com:

let

URL = "https://api.some_service.com/api/reporting/",

Options = [

Headers = [Accept="application/json", Authorization="Token api_key"],

RelativePath = "v1/rooms/" & some_parameter_I_used & "/user-online-times/" & another_parameter_I_used

],

Source = Json.Document(Web.Contents(URL,Options)),

 

No Replies