<?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 API Issues in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/API-Issues/m-p/2086625#M31896</link>
    <description>&lt;P&gt;I'm attempting to use PyPowerBi to access the API in Python and I'm hitting a lot of weird permissions issues.&amp;nbsp; I don't believe it's the fault of the Python library, but I mentioned it just in case.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm able to authenticate using&amp;nbsp;&lt;A href="https://analysis.windows.net/powerbi/api" target="_blank" rel="noopener"&gt;https://analysis.windows.net/powerbi/api&lt;/A&gt;&amp;nbsp;as the resource URL and then using my application's client ID and client secret.&amp;nbsp; This returns a token successfully.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I attempt to use the token, that's where the issues occur.&amp;nbsp; If I hit&amp;nbsp;&lt;A href="https://api.powerbi.com/v1.0/myorg/groups" target="_blank" rel="noopener"&gt;https://api.powerbi.com/v1.0/myorg/groups&lt;/A&gt;&amp;nbsp;to get a list of groups, it returns no groups even though I have one configured.&amp;nbsp; If I then hit the endpoint to get reports, I get an error that says "API is not accessible for application".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have all of the following API permissions set for the user:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rsrwebsupport_0-1632151808097.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/596969i1F5BD5C100506EC9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="rsrwebsupport_0-1632151808097.png" alt="rsrwebsupport_0-1632151808097.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Does anyone have any idea what I might be missing?&amp;nbsp; Thanks.&lt;/P&gt;</description>
    <pubDate>Mon, 20 Sep 2021 15:31:57 GMT</pubDate>
    <dc:creator>rsrwebsupport</dc:creator>
    <dc:date>2021-09-20T15:31:57Z</dc:date>
    <item>
      <title>API Issues</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/API-Issues/m-p/2086625#M31896</link>
      <description>&lt;P&gt;I'm attempting to use PyPowerBi to access the API in Python and I'm hitting a lot of weird permissions issues.&amp;nbsp; I don't believe it's the fault of the Python library, but I mentioned it just in case.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm able to authenticate using&amp;nbsp;&lt;A href="https://analysis.windows.net/powerbi/api" target="_blank" rel="noopener"&gt;https://analysis.windows.net/powerbi/api&lt;/A&gt;&amp;nbsp;as the resource URL and then using my application's client ID and client secret.&amp;nbsp; This returns a token successfully.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I attempt to use the token, that's where the issues occur.&amp;nbsp; If I hit&amp;nbsp;&lt;A href="https://api.powerbi.com/v1.0/myorg/groups" target="_blank" rel="noopener"&gt;https://api.powerbi.com/v1.0/myorg/groups&lt;/A&gt;&amp;nbsp;to get a list of groups, it returns no groups even though I have one configured.&amp;nbsp; If I then hit the endpoint to get reports, I get an error that says "API is not accessible for application".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have all of the following API permissions set for the user:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rsrwebsupport_0-1632151808097.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/596969i1F5BD5C100506EC9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="rsrwebsupport_0-1632151808097.png" alt="rsrwebsupport_0-1632151808097.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Does anyone have any idea what I might be missing?&amp;nbsp; Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Sep 2021 15:31:57 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/API-Issues/m-p/2086625#M31896</guid>
      <dc:creator>rsrwebsupport</dc:creator>
      <dc:date>2021-09-20T15:31:57Z</dc:date>
    </item>
    <item>
      <title>Re: API Issues</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/API-Issues/m-p/2087584#M31911</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/327390"&gt;@rsrwebsupport&lt;/a&gt;&amp;nbsp;PyPowerBI is not an official library. Any errors related to the use of this library is a question sadly needs answering from the owner of the code.&lt;BR /&gt;&lt;BR /&gt;But i've used the following code to authenticate and call some dataset refreshes:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import adal
import requests
import json

#Aunthentication
authority_url = 'https://login.microsoftonline.com/&amp;lt;INSERT TENANT ID&amp;gt;'
resource_url = 'https://analysis.windows.net/powerbi/api'
client_id = '&amp;lt;INSERT CLIENT ID&amp;gt;'
client_secret = '&amp;lt;INSERT CLIENT SECRET&amp;gt;'
context = adal.AuthenticationContext(authority=authority_url,
                                     validate_authority=True,
                                     api_version=None)
token = context.acquire_token_with_client_credentials(resource = resource_url,client_id=client_id,client_secret=client_secret)
access_token = token.get('accessToken')

#Refresh Dataset
refresh_url = 'https://api.powerbi.com/v1.0/myorg/groups/&amp;lt;INSERT GROUP ID&amp;gt;/datasets/&amp;lt;INSERT DATASET ID&amp;gt;/refreshes'
header = {'Authorization': f'Bearer {access_token}'}
r = requests.post(url=refresh_url, headers=header)
r.raise_for_status()
print(json.dumps(r.text))&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Sep 2021 03:58:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/API-Issues/m-p/2087584#M31911</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-09-21T03:58:55Z</dc:date>
    </item>
    <item>
      <title>Re: API Issues</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/API-Issues/m-p/2088966#M31926</link>
      <description>&lt;P&gt;Thanks for the response.&amp;nbsp; I tried the code you posted, and it's able to authenticate and get the token, but the API call returns a 404, which is basically what I was seeing with PyPowerBi.&amp;nbsp; I was ultimately able to get it working by authenticating via the "acquire_token_with_username_password" function in ADAL and just using the account's username/password, but ideally we would use the client credentials to authenticate.&amp;nbsp; Can you think of any reason why the one authentication would work for the API but the other would not?&lt;/P&gt;</description>
      <pubDate>Tue, 21 Sep 2021 14:31:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/API-Issues/m-p/2088966#M31926</guid>
      <dc:creator>rsrwebsupport</dc:creator>
      <dc:date>2021-09-21T14:31:39Z</dc:date>
    </item>
    <item>
      <title>Re: API Issues</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/API-Issues/m-p/2088993#M31928</link>
      <description>&lt;P&gt;Not exactly sure, but i'm assuming there is a differnce between your acess credentials as user v/s the app.&lt;BR /&gt;The Microsoft documentation does mention the app to have 'ReadWrite.All' permission which is not visible in our screenshot above.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sbanda_1-1632235619253.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/597721iDBAD0961FF9E2253/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sbanda_1-1632235619253.png" alt="sbanda_1-1632235619253.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Sep 2021 14:47:55 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/API-Issues/m-p/2088993#M31928</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-09-21T14:47:55Z</dc:date>
    </item>
    <item>
      <title>Re: API Issues</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/API-Issues/m-p/2089124#M31930</link>
      <description>&lt;P&gt;I just tried adding all of the write permissions and it still didn't seem to make a difference.&amp;nbsp; One thing I did notice is that I'm able to hit the groups API with the client credentials authentication, but it returns no groups, whereas the username/password authentication returns the group as expected.&amp;nbsp; I'm assuming there's some setting somewhere that I'm missing, but I can't seem to find it.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Sep 2021 15:44:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/API-Issues/m-p/2089124#M31930</guid>
      <dc:creator>rsrwebsupport</dc:creator>
      <dc:date>2021-09-21T15:44:43Z</dc:date>
    </item>
  </channel>
</rss>

