<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Power BI REST API authentication in Report Server</title>
    <link>https://community.fabric.microsoft.com/t5/Report-Server/Power-BI-REST-API-authentication/m-p/295706#M1853</link>
    <description>&lt;P&gt;Thanks! Though I still get the error message &lt;EM&gt;Unable to connect to the remote server&lt;/EM&gt;. I tried this:&lt;/P&gt;&lt;PRE&gt;FoldersApi client = new FoldersApi("http://server/reports/api/v2.0/Folders");&lt;/PRE&gt;&lt;P&gt;But I get the same error again. Both URLs gives me some JSON in Chrome.&lt;/P&gt;</description>
    <pubDate>Fri, 03 Nov 2017 07:35:05 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-11-03T07:35:05Z</dc:date>
    <item>
      <title>Power BI REST API authentication</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Power-BI-REST-API-authentication/m-p/295470#M1842</link>
      <description>&lt;P&gt;How do I authenticate the user when calling the REST API?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;FoldersApi client = new FoldersApi("http://server/reports/api/v2.0");
client.Configuration.Username = "usernamne";
client.Configuration.Password = "password";

ODataFolders result = apiInstance.GetFolders(top, skip, filter, count, orderBy, select);&lt;/PRE&gt;&lt;P&gt;This results in &lt;EM&gt;Error calling GetFolders: Unable to connect to the remote server...&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2017 21:56:23 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Power-BI-REST-API-authentication/m-p/295470#M1842</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-02T21:56:23Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI REST API authentication</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Power-BI-REST-API-authentication/m-p/295474#M1843</link>
      <description>&lt;P&gt;If your using the code generated from Swagger you need to us the NtlmAuthenticator, setting user name and password with likely use basic auth:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;client.Configuration.ApiClient.RestClient.Authenticator = new NtlmAuthenticator(CredentialCache.DefaultCredentials);&lt;/P&gt;</description>
      <pubDate>Thu, 02 Nov 2017 22:08:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Power-BI-REST-API-authentication/m-p/295474#M1843</guid>
      <dc:creator>mgmeyer</dc:creator>
      <dc:date>2017-11-02T22:08:01Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI REST API authentication</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Power-BI-REST-API-authentication/m-p/295706#M1853</link>
      <description>&lt;P&gt;Thanks! Though I still get the error message &lt;EM&gt;Unable to connect to the remote server&lt;/EM&gt;. I tried this:&lt;/P&gt;&lt;PRE&gt;FoldersApi client = new FoldersApi("http://server/reports/api/v2.0/Folders");&lt;/PRE&gt;&lt;P&gt;But I get the same error again. Both URLs gives me some JSON in Chrome.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Nov 2017 07:35:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Power-BI-REST-API-authentication/m-p/295706#M1853</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-03T07:35:05Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI REST API authentication</title>
      <link>https://community.fabric.microsoft.com/t5/Report-Server/Power-BI-REST-API-authentication/m-p/298682#M2041</link>
      <description>&lt;P&gt;I solved the problem by just using RestSharp and Newtonsoft.Json. I created a ASP.Net Core API project and this is the code for my controller.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using RestSharp;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;

namespace PortalAPI.Controllers
{
    [Produces("application/json")]
    [Route("api/Reports")]
    public class ReportsController : Controller
    {
        private static string PBI_REST_API_URL = "http://myserver/reports/api/v2.0";

        private static string PBI_REPORTS_URL = "http://myserver/reports/powerbi";

        // GET api/values
        [HttpGet]
        public string Get()
        {
            var client = new RestClient(PBI_REST_API_URL)
            {
                Authenticator = new RestSharp.Authenticators.NtlmAuthenticator()
            };
            RestRequest reportsRequest = new RestRequest("/CatalogItems", Method.GET);

            var response = client.Execute(reportsRequest);

            var svar = JObject.Parse(response.Content);

            var reportList = (JArray)svar["value"];

            var resultReportList = new List&amp;lt;Report&amp;gt;();

            foreach(JObject report in reportList)
            {
                if (((string)report["@odata.type"]).Equals("#Model.PowerBIReport"))
                {
                    resultReportList.Add(new Report { Name = (string)report["Name"], Path = PBI_REPORTS_URL + (string)report["Path"] });
                }
            }

            return JsonConvert.SerializeObject(resultReportList); ;
        }
    }

    public class Report
    {
        public string Name { get; set; }
        public string Path { get; set; }
    }
}&lt;/PRE&gt;&lt;P&gt;Since I dont need all values from the returnd JSON it was very conveniant to just pick the stuff I needed with Newtonsoft.Json. The service will have to be run with an account that has access to PBI Report Server. Hope this helps someone.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Nov 2017 07:27:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Report-Server/Power-BI-REST-API-authentication/m-p/298682#M2041</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-08T07:27:09Z</dc:date>
    </item>
  </channel>
</rss>

