<?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: Connect API oauth2 to pull data in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Connect-API-oauth2-to-pull-data/m-p/2496674#M35928</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/378179"&gt;@Falcon&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;I'll need to see your actual code to figure it out.&lt;BR /&gt;Instead, have a look at the&amp;nbsp;following code.&lt;BR /&gt;It will generate an OAuth2 access token from AAD, to the Power BI Service, using a service principal.&lt;BR /&gt;You probably need an access token to another scope or not to AAD at all...&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let
    TenantId = "XXXXXX",
    ClientId = "XXXXXX",
    ClientSecret = "XXXXXX",
    Uri = "https://login.microsoftonline.com/" &amp;amp; TenantId &amp;amp; "/oauth2/v2.0/token/",
    Body =
    "scope=https://analysis.windows.net/powerbi/api/.default" &amp;amp;
    "&amp;amp;grant_type=client_credentials" &amp;amp;
    "&amp;amp;client_id=" &amp;amp; ClientId &amp;amp;
    "&amp;amp;client_secret=" &amp;amp; ClientSecret,
    OAuth2Response = Json.Document(Web.Contents(Uri, [Content=Text.ToBinary(Body)])),
    access_token = OAuth2Response[access_token]
in
    access_token&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 05 May 2022 16:59:00 GMT</pubDate>
    <dc:creator>SpartaBI</dc:creator>
    <dc:date>2022-05-05T16:59:00Z</dc:date>
    <item>
      <title>Connect API oauth2 to pull data</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Connect-API-oauth2-to-pull-data/m-p/2491298#M35879</link>
      <description>&lt;P&gt;Hello Everyone,&lt;/P&gt;&lt;P&gt;I am trying to pull API data using oauth2. I have been following different methods online without success. All I have are&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;token URL: &lt;A href="https://xxxxxxxx/api/v2/oauth/token" target="_blank" rel="noopener"&gt;https://xxxxxxxx/api/v2/oauth/token&lt;/A&gt;&lt;/LI&gt;&lt;LI&gt;client_id: xxxxxxxx&lt;/LI&gt;&lt;LI&gt;client_secret: xxxxxxxx&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I am able to get the token and pull data in the Postman. However, I am not able to do that in Power BI. Can anyone provide me with a solution? Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2022 15:39:05 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Connect-API-oauth2-to-pull-data/m-p/2491298#M35879</guid>
      <dc:creator>Falcon</dc:creator>
      <dc:date>2022-05-03T15:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: Connect API oauth2 to pull data</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Connect-API-oauth2-to-pull-data/m-p/2491450#M35882</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/378179"&gt;@Falcon&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;You'll need to use the M function &lt;A href="https://docs.microsoft.com/en-us/powerquery-m/web-contents" target="_blank" rel="noopener"&gt;Web.Contents&lt;/A&gt; in Power Query in order to call a rest API.&lt;BR /&gt;There are many examples of how to perform an OAuth2 flow in Power BI throughout the web.&lt;BR /&gt;For example (this one is using a user delegation- but you'll get the idea):&amp;nbsp;&lt;A href="https://www.linkedin.com/pulse/accessing-api-oauth2-using-m-language-power-bi-diogenes-santos" target="_blank" rel="noopener"&gt;https://www.linkedin.com/pulse/accessing-api-oauth2-using-m-language-power-bi-diogenes-santos&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2022 16:58:43 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Connect-API-oauth2-to-pull-data/m-p/2491450#M35882</guid>
      <dc:creator>SpartaBI</dc:creator>
      <dc:date>2022-05-03T16:58:43Z</dc:date>
    </item>
    <item>
      <title>Re: Connect API oauth2 to pull data</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Connect-API-oauth2-to-pull-data/m-p/2496427#M35927</link>
      <description>&lt;P&gt;I followed the instructions, but I got "400 Bad Request" from the token URL from the script. Do you know why? I am sure that URL is correct. Below is what I got&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DataSource.Error: Web.Contents failed to get contents from '&lt;A href="https://xxxxxxxxxxxx/oauth/token" target="_blank"&gt;https://xxxxxxxxxxxx/oauth/token&lt;/A&gt;' (400): Bad Request&lt;BR /&gt;Details:&lt;BR /&gt;DataSourceKind=Web&lt;BR /&gt;DataSourcePath=&lt;A href="https://xxxxxxxxxxxx/oauth/token" target="_blank"&gt;https://xxxxxxxxxxxx/oauth/token&lt;/A&gt;&lt;BR /&gt;Url=&lt;A href="https://xxxxxxxxxxxx/oauth/token" target="_blank"&gt;https://xxxxxxxxxxxx/oauth/token&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2022 16:38:20 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Connect-API-oauth2-to-pull-data/m-p/2496427#M35927</guid>
      <dc:creator>Falcon</dc:creator>
      <dc:date>2022-05-05T16:38:20Z</dc:date>
    </item>
    <item>
      <title>Re: Connect API oauth2 to pull data</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Connect-API-oauth2-to-pull-data/m-p/2496674#M35928</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/378179"&gt;@Falcon&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;I'll need to see your actual code to figure it out.&lt;BR /&gt;Instead, have a look at the&amp;nbsp;following code.&lt;BR /&gt;It will generate an OAuth2 access token from AAD, to the Power BI Service, using a service principal.&lt;BR /&gt;You probably need an access token to another scope or not to AAD at all...&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let
    TenantId = "XXXXXX",
    ClientId = "XXXXXX",
    ClientSecret = "XXXXXX",
    Uri = "https://login.microsoftonline.com/" &amp;amp; TenantId &amp;amp; "/oauth2/v2.0/token/",
    Body =
    "scope=https://analysis.windows.net/powerbi/api/.default" &amp;amp;
    "&amp;amp;grant_type=client_credentials" &amp;amp;
    "&amp;amp;client_id=" &amp;amp; ClientId &amp;amp;
    "&amp;amp;client_secret=" &amp;amp; ClientSecret,
    OAuth2Response = Json.Document(Web.Contents(Uri, [Content=Text.ToBinary(Body)])),
    access_token = OAuth2Response[access_token]
in
    access_token&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2022 16:59:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Connect-API-oauth2-to-pull-data/m-p/2496674#M35928</guid>
      <dc:creator>SpartaBI</dc:creator>
      <dc:date>2022-05-05T16:59:00Z</dc:date>
    </item>
    <item>
      <title>Re: Connect API oauth2 to pull data</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Connect-API-oauth2-to-pull-data/m-p/2496729#M35929</link>
      <description>&lt;P&gt;Hello Sparta Bi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code by following the above instruction. The "tokenUserName" and "tokenPassword" hold "client_id" and "client_secret" respectively. The "tokenAddress" holds the URL which is "&lt;A href="https://secure9.aladtec.com/mohcacc/api/v2/oauth/token&amp;quot;" target="_blank"&gt;https://xxxxxxxxxxx/mohcacc/api/v2/oauth/token"&lt;/A&gt;. I don't have TenantId and scope as in your example. How do I get them?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;let body = "{&lt;BR /&gt;""username"" = " &amp;amp; tokenUserName &amp;amp; ",&lt;BR /&gt;""password"" = " &amp;amp; tokenPassword &amp;amp; "&lt;BR /&gt;}",&lt;/P&gt;&lt;P&gt;getToken = Web.Contents(&lt;BR /&gt;tokenAddress,&lt;BR /&gt;[Content = Text.ToBinary(body)]&lt;BR /&gt;)&lt;BR /&gt;in getToken&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2022 17:21:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Connect-API-oauth2-to-pull-data/m-p/2496729#M35929</guid>
      <dc:creator>Falcon</dc:creator>
      <dc:date>2022-05-05T17:21:18Z</dc:date>
    </item>
    <item>
      <title>Re: Connect API oauth2 to pull data</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Connect-API-oauth2-to-pull-data/m-p/2496753#M35930</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/378179"&gt;@Falcon&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;The TenantId &amp;amp; scope are relevant for the AAD OAuth2 flow. In your case, you probably do not need them.&lt;BR /&gt;&lt;BR /&gt;Did you try changing&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let body = "{
""username"" = " &amp;amp; tokenUserName &amp;amp; ",
""password"" = " &amp;amp; tokenPassword &amp;amp; "
}",&lt;/LI-CODE&gt;&lt;P&gt;to&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let body = "{
""client_id"" = " &amp;amp; tokenUserName &amp;amp; ",
""client_secret"" = " &amp;amp; tokenPassword &amp;amp; "
}",&lt;/LI-CODE&gt;&lt;P&gt;?&lt;BR /&gt;&lt;BR /&gt;If this doesn't help, please share the successful "get token" postman request.&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2022 17:33:39 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Connect-API-oauth2-to-pull-data/m-p/2496753#M35930</guid>
      <dc:creator>SpartaBI</dc:creator>
      <dc:date>2022-05-05T17:33:39Z</dc:date>
    </item>
    <item>
      <title>Re: Connect API oauth2 to pull data</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Connect-API-oauth2-to-pull-data/m-p/2496776#M35931</link>
      <description>&lt;P&gt;Yes, I did change username and password to client_id and client_secret as you suggested. I just got the error message&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;DataSource.Error: Web.Contents failed to get contents from '&lt;A href="https://xxxxxxxxxxx/mohcacc/api/v2/oauth/token" target="_blank"&gt;https://xxxxxxxxxxx/mohcacc/api/v2/oauth/token&lt;/A&gt;' (400): Bad Request&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Details:&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;DataSourceKind=Web&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;DataSourcePath=&lt;A href="https://xxxxxxxxxxx/mohcacc/api/v2/oauth/token" target="_blank"&gt;https://xxxxxxxxxxx/mohcacc/api/v2/oauth/token&lt;/A&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Url=&lt;A href="https://xxxxxxxxxxx/mohcacc/api/v2/oauth/token" target="_blank"&gt;https://xxxxxxxxxxx/mohcacc/api/v2/oauth/token&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;In Postman, I was able to retrieve the token with the following script in body&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt;"grant_type": "client_credentials",&lt;BR /&gt;"client_id": "xxxxxxxxxxxxxxxx",&lt;BR /&gt;"client_secret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2022 17:44:24 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Connect-API-oauth2-to-pull-data/m-p/2496776#M35931</guid>
      <dc:creator>Falcon</dc:creator>
      <dc:date>2022-05-05T17:44:24Z</dc:date>
    </item>
    <item>
      <title>Re: Connect API oauth2 to pull data</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Connect-API-oauth2-to-pull-data/m-p/2496789#M35932</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/378179"&gt;@Falcon&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;Try this code&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let
    ClientId = "XXXXXX",
    ClientSecret = "XXXXXX",
    Uri = "https://xxxxxxxxxxx/mohcacc/api/v2/oauth/token",
    Body ="{
        ""grant_type"" = ""client_credentials"",
        ""client_id"" = """ &amp;amp; ClientId &amp;amp; """,
        ""client_secret"" = """ &amp;amp; ClientSecret &amp;amp; """,
}",
    OAuth2Response = Json.Document(Web.Contents(Uri, [Content=Text.ToBinary(Body)]))
in
    OAuth2Response&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 05 May 2022 17:54:44 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Connect-API-oauth2-to-pull-data/m-p/2496789#M35932</guid>
      <dc:creator>SpartaBI</dc:creator>
      <dc:date>2022-05-05T17:54:44Z</dc:date>
    </item>
    <item>
      <title>Re: Connect API oauth2 to pull data</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Connect-API-oauth2-to-pull-data/m-p/2496855#M35933</link>
      <description>&lt;P&gt;Here is the code I entered&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;let&lt;BR /&gt;ClientId = "xxxxxxx",&lt;BR /&gt;ClientSecret = "xxxxxxxxxxxx",&lt;BR /&gt;Uri = "&lt;A href="https://secure9.aladtec.com/mohcacc/api/v2/oauth/token" target="_blank"&gt;https://secure9.aladtec.com/mohcacc/api/v2/oauth/token&lt;/A&gt;",&lt;BR /&gt;Body ="{&lt;BR /&gt;""grant_type"" = ""client_credentials"",&lt;BR /&gt;""client_id"" = """ &amp;amp; ClientId &amp;amp; """,&lt;BR /&gt;""client_secret"" = """ &amp;amp; ClientSecret &amp;amp; """,&lt;BR /&gt;}",&lt;BR /&gt;OAuth2Response = Json.Document(Web.Contents(Uri, [Content=Text.ToBinary(Body)]))&lt;BR /&gt;in&lt;BR /&gt;OAuth2Response&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is what response I got&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;DataSource.Error: Web.Contents failed to get contents from '&lt;A href="https://secure9.aladtec.com/mohcacc/api/v2/oauth/token" target="_blank"&gt;https://secure9.aladtec.com/mohcacc/api/v2/oauth/token&lt;/A&gt;' (400): Bad Request&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Details:&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;DataSourceKind=Web&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;DataSourcePath=&lt;A href="https://secure9.aladtec.com/mohcacc/api/v2/oauth/token" target="_blank"&gt;https://secure9.aladtec.com/mohcacc/api/v2/oauth/token&lt;/A&gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;Url=&lt;A href="https://secure9.aladtec.com/mohcacc/api/v2/oauth/token" target="_blank"&gt;https://secure9.aladtec.com/mohcacc/api/v2/oauth/token&lt;/A&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2022 18:23:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Connect-API-oauth2-to-pull-data/m-p/2496855#M35933</guid>
      <dc:creator>Falcon</dc:creator>
      <dc:date>2022-05-05T18:23:27Z</dc:date>
    </item>
    <item>
      <title>Re: Connect API oauth2 to pull data</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Connect-API-oauth2-to-pull-data/m-p/2496897#M35935</link>
      <description>&lt;P&gt;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/378179"&gt;@Falcon&lt;/a&gt;&lt;BR /&gt;&lt;BR /&gt;I've just noticed that the json was malformed + I've added a relative path for the auth.&lt;BR /&gt;Try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let
    ClientId = "XXXXXXX",
    ClientSecret = "XXXXXXX",
    Uri = "https://secure9.aladtec.com/",
    Body ="{
        ""grant_type"": ""client_credentials"",
        ""client_id"": """ &amp;amp; ClientId &amp;amp; """,
        ""client_secret"": """ &amp;amp; ClientSecret &amp;amp; """
}",
    OAuth2Response = Web.Contents(Uri, [RelativePath = "mohcacc/api/v2/oauth/token", Content=Text.ToBinary(Body)])
in
    OAuth2Response&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2022 19:04:01 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Connect-API-oauth2-to-pull-data/m-p/2496897#M35935</guid>
      <dc:creator>SpartaBI</dc:creator>
      <dc:date>2022-05-05T19:04:01Z</dc:date>
    </item>
    <item>
      <title>Re: Connect API oauth2 to pull data</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Connect-API-oauth2-to-pull-data/m-p/2496903#M35936</link>
      <description>&lt;P&gt;OMG that worked, thanks SpartaBI, you're such a big help&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2022 19:20:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Connect-API-oauth2-to-pull-data/m-p/2496903#M35936</guid>
      <dc:creator>Falcon</dc:creator>
      <dc:date>2022-05-05T19:20:04Z</dc:date>
    </item>
    <item>
      <title>Re: Connect API oauth2 to pull data</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Connect-API-oauth2-to-pull-data/m-p/2496905#M35937</link>
      <description>&lt;P&gt;My pleasure.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;This Is SpartaBI !&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.spartabi.com" target="_blank"&gt;www.spartabi.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.linkedin.com/company/spartabi" target="_blank"&gt;https://www.linkedin.com/company/spartabi&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2022 19:23:09 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Connect-API-oauth2-to-pull-data/m-p/2496905#M35937</guid>
      <dc:creator>SpartaBI</dc:creator>
      <dc:date>2022-05-05T19:23:09Z</dc:date>
    </item>
    <item>
      <title>Re: Connect API oauth2 to pull data</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Connect-API-oauth2-to-pull-data/m-p/2496967#M35938</link>
      <description>&lt;P&gt;Hello SpartaBi,&lt;/P&gt;&lt;P&gt;Can you help me a bit further? Now I got the token, how do I use it to retrieve the data?&lt;/P&gt;</description>
      <pubDate>Thu, 05 May 2022 20:15:35 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Connect-API-oauth2-to-pull-data/m-p/2496967#M35938</guid>
      <dc:creator>Falcon</dc:creator>
      <dc:date>2022-05-05T20:15:35Z</dc:date>
    </item>
    <item>
      <title>Re: Connect API oauth2 to pull data</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Connect-API-oauth2-to-pull-data/m-p/2498157#M35942</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/378179"&gt;@Falcon&lt;/a&gt;,&lt;BR /&gt;&lt;BR /&gt;With an OAuth2 token, you should probably do something like:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let
    Token = "XXXXXXXXX",
    DataUri = "https://secure9.aladtec.com/XXXXXXXXX",
    AuthHeaders = [Authorization = "Bearer " &amp;amp; Token],
    Response = Json.Document(Web.Contents(DataUri, [Headers = AuthHeaders]))
in
    Response&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;You can create a different PQ query for the second API call, or add it to the same query.&lt;BR /&gt;&lt;BR /&gt;If this doesn't work, please create a new issue with details regarding the API that should retrieve&amp;nbsp; the data (e.g., a successful postman request with a hardcoded token). This makes it easier for community members to locate solutions to similar problems.&lt;BR /&gt;&lt;BR /&gt;Tag me (using&amp;nbsp;@) in the new issue, so I'll get a notification, and I'll try to look into it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 May 2022 09:09:11 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Connect-API-oauth2-to-pull-data/m-p/2498157#M35942</guid>
      <dc:creator>SpartaBI</dc:creator>
      <dc:date>2022-05-06T09:09:11Z</dc:date>
    </item>
  </channel>
</rss>

