<?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: Rest API - No GUI in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Rest-API-No-GUI/m-p/302707#M8924</link>
    <description>&lt;P&gt;Check out &lt;A href="https://zappysys.com/blog/http-post-in-ssis-send-data-to-web-api-url-json-xml/" target="_self"&gt;SSIS REST&amp;nbsp;API&lt;/A&gt;&amp;nbsp;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope it's useful for you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 14 Nov 2017 09:10:11 GMT</pubDate>
    <dc:creator>nancy1989</dc:creator>
    <dc:date>2017-11-14T09:10:11Z</dc:date>
    <item>
      <title>Rest API - No GUI</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Rest-API-No-GUI/m-p/218761#M6885</link>
      <description>&lt;P&gt;I need to develop an API that when invoked via an endpoint will run an automatic data gathering service and add the results to a PowerBI Streaming Dataset, yet I can't seem to be able to achieve authorization.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using .NET Core.&lt;/P&gt;&lt;P&gt;I've followed the tutorials to register my App with the AAD, however the ADAL Library doesn't seem to support the authentication suggested for the native app.&lt;/P&gt;&lt;P&gt;So far, using a web app-style registration, I'm able to get an auth token, yet when I submit a request to the API (&lt;A href="https://api.powerbi.com/v1.0/myorg/datasets" target="_blank"&gt;https://api.powerbi.com/v1.0/myorg/datasets&lt;/A&gt;) I receive a HTTP 403 Forbidden.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code I'm running to get the auth token:&lt;/P&gt;&lt;PRE&gt;var clientCredential = new ClientCredential(clientID, clientSecret);
var authContext = new AuthenticationContext(authorityUri);
var authResult = await authContext.AcquireTokenAsync(resourceUri, clientCredential);
var token = authResult.AccessToken;&lt;/PRE&gt;&lt;P&gt;Got any Ideas? Thank you for your help!&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jul 2017 17:36:40 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Rest-API-No-GUI/m-p/218761#M6885</guid>
      <dc:creator>nunovalente</dc:creator>
      <dc:date>2017-07-25T17:36:40Z</dc:date>
    </item>
    <item>
      <title>Re: Rest API - No GUI</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Rest-API-No-GUI/m-p/219667#M6921</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/37129"&gt;@nunovalente&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I ran into the same exact issue when setting up my embedded proof of concept. &amp;nbsp;The solution that worked for me was that the user account credential needed to be made an admin of the workspace I was accessing. &amp;nbsp;When I originally added the account I just made it a&amp;nbsp;Member and received 403's. &amp;nbsp;Once I changed it to an admin everything worked properly.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jul 2017 17:05:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Rest-API-No-GUI/m-p/219667#M6921</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-26T17:05:01Z</dc:date>
    </item>
    <item>
      <title>Re: Rest API - No GUI</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Rest-API-No-GUI/m-p/219987#M6940</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/37129"&gt;@nunovalente&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;@Anonymous&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;I register a native app but generate the token not via the ADAL library. Instead I'm calling the REST API directly and the token generated could help me to refresh/retrive datasets etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt; static string getAccessTokenSilently()
        {
            string resourceUri = "https://analysis.windows.net/powerbi/api";
            HttpWebRequest request = System.Net.HttpWebRequest.CreateHttp("https://login.windows.net/common/oauth2/token");
            //POST web request to create a datasource.
            request.KeepAlive = true;
            request.Method = "POST";
            request.ContentLength = 0;
            request.ContentType = "application/x-www-form-urlencoded"; 

            NameValueCollection parsedQueryString = HttpUtility.ParseQueryString(String.Empty);
            parsedQueryString.Add("client_id", clientID);
            parsedQueryString.Add("grant_type", "password");
            parsedQueryString.Add("resource", resourceUri);
            parsedQueryString.Add("username", username);
            parsedQueryString.Add("password", password);
            string postdata = parsedQueryString.ToString();


            //POST web request
            byte[] dataByteArray = System.Text.Encoding.ASCII.GetBytes(postdata); ;
            request.ContentLength = dataByteArray.Length;

            //Write JSON byte[] into a Stream
            using (Stream writer = request.GetRequestStream())
            {
                writer.Write(dataByteArray, 0, dataByteArray.Length);
                var response = (HttpWebResponse)request.GetResponse();
                var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
                dynamic responseJson = JsonConvert.DeserializeObject&amp;lt;dynamic&amp;gt;(responseString);
                return responseJson["access_token"];
            }


        }&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Jul 2017 06:30:25 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Rest-API-No-GUI/m-p/219987#M6940</guid>
      <dc:creator>Eric_Zhang</dc:creator>
      <dc:date>2017-07-27T06:30:25Z</dc:date>
    </item>
    <item>
      <title>Re: Rest API - No GUI</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Rest-API-No-GUI/m-p/221259#M6984</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/6971"&gt;@Eric_Zhang&lt;/a&gt;&lt;/P&gt;&lt;P&gt;I just tested creating such a request and indeed I received an access token and a refresh token.&lt;/P&gt;&lt;P&gt;There are downsides, ADAL does token refreshment management whilst using this approach would require one to implement their own. (Or just request a new access token for each request).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your insight, this might save a lot of people running into the same problem.&lt;/P&gt;&lt;P&gt;I ended up discovering another approach which I've used, and it's simpler, nonetheless I'm accepting yours as a solution as it does, indeed, solve the problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;About the path I took: I discovered, in my PowerBI's streaming dataset settings, a unique "push url" which allows you to push data to said dataset without bothering with authorization/authentication overhead, as the link per se does the authorization part.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once again, thank you for your really interesting code snippet!&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jul 2017 15:21:37 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Rest-API-No-GUI/m-p/221259#M6984</guid>
      <dc:creator>nunovalente</dc:creator>
      <dc:date>2017-07-28T15:21:37Z</dc:date>
    </item>
    <item>
      <title>Re: Rest API - No GUI</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Rest-API-No-GUI/m-p/230576#M7263</link>
      <description>&lt;P&gt;Dear&amp;nbsp;&lt;SPAN class="UserName lia-user-name lia-user-rank-Moderator"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;A title="" href="http://community.powerbi.com/t5/user/viewprofilepage/user-id/6971" target="_self"&gt;Eric_Zhang&lt;/A&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="UserName lia-user-name lia-user-rank-Moderator"&gt;&lt;SPAN class=""&gt;When I use above code to get the token I get &lt;STRONG&gt;The remote server returned an error: (400) Bad Request.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="UserName lia-user-name lia-user-rank-Moderator"&gt;&lt;SPAN class=""&gt;Do you know why this error is thrown?&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2017 06:09:16 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Rest-API-No-GUI/m-p/230576#M7263</guid>
      <dc:creator>wakhan07</dc:creator>
      <dc:date>2017-08-14T06:09:16Z</dc:date>
    </item>
    <item>
      <title>Re: Rest API - No GUI</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Rest-API-No-GUI/m-p/302707#M8924</link>
      <description>&lt;P&gt;Check out &lt;A href="https://zappysys.com/blog/http-post-in-ssis-send-data-to-web-api-url-json-xml/" target="_self"&gt;SSIS REST&amp;nbsp;API&lt;/A&gt;&amp;nbsp;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope it's useful for you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2017 09:10:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Rest-API-No-GUI/m-p/302707#M8924</guid>
      <dc:creator>nancy1989</dc:creator>
      <dc:date>2017-11-14T09:10:11Z</dc:date>
    </item>
  </channel>
</rss>

