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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
IbisRipley
Frequent Visitor

on-prem (PBIRS) APIs to use for datasources (Paginated, PBI, and shared )

Hi all

We are using PBIRS (latest release). I am a report developer and I am being asked to compile a list of username and connect strings, and eventually I'd like to be able to modify the username as well.  It seems as if using an API is the best approach and I don't have much experience but I have created 2 scripts (below) and looking for general feedback.

 

My requirements are to Retrieve a list of ALL Datasources ( of all 3 types ) with Connectstring and userID

I have built 2 powershell scripts as follows

(REST, I believe)

 $ReportServerURI = "<Reportserverserver>/Reports/"
$session = New-RsRestSession -ReportPortalUri $ReportServerURI;
$rsItems = Get-RsFolderContent -RsFolder $startingFolder -ReportServerUri $ReportServerURI -Recurse | Where-Object -Property "TypeName" -In "PowerBIReport", "Report";
foreach ($rsitem In $rsItems )
$rds = Get-RsRestItemDataSource -WebSession $session -RsItem $rsitem.Path;

foreach ($d in $rds)
{
$DataSourceUser = $d.DataModelDataSource.Username
$datasourceConnectString = $d.DataModelDataSource # I notice the connectstring is in here, so I think I can parse it out.

This returns most of the fields for Power BI reports, but I was unable to find the values for paginated

 

(Old SOAP API?)

$uri = "Reportserver//ReportServer/ReportService2010.asmx?WSDL" }

$reporting = New-WebServiceProxy -uri $uri -UseDefaultCredential -namespace "ReportingWebService"
$reports = $reporting.ListChildren($startingFolder, $True) | Where-Object {$_.TypeName -eq "Report"}

foreach($report in $reports)
{ $reportpath = $report.Path

$dataSources = $reporting.GetItemDataSources($report.Path)
foreach($dataSource in $dataSources)

$DataSourceUser = $dataSource.Item.UserName
$datasourceConnectString = $dataSource.Item.ConnectString

This one seems to get most of the Paginated but not much on the PBI side..

 

I have read quite a few posts with code samples etc. regarding datasource information but wondering if anyone can explain whether one or the other API should be used for both (noteven sure about shared connections)  or if it's possible to get Connectstring/username for both types of report (preferably shared also) 

Any information or links are appreciated.

1 REPLY 1
v-henryk-mstf
Community Support
Community Support

Hi @IbisRipley ,

 

Seems a bit tricky, see if a similar solution helps you.

asp.net - Is it possible to change the username with the Membership API - Stack Overflow


Best Regards,
Henry


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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

Top Solution Authors