<?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 and Personio API: Dynamic single-use token in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-and-Personio-API-Dynamic-single-use-token/m-p/3935615#M52704</link>
    <description>&lt;P&gt;Hey there,&lt;/P&gt;&lt;P&gt;thank you guys for your effort. I have tried adapting your solution, but to no success. Is this still working for you or do you happen to have any updated solutions?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
    <pubDate>Tue, 21 May 2024 11:06:34 GMT</pubDate>
    <dc:creator>PhilippM</dc:creator>
    <dc:date>2024-05-21T11:06:34Z</dc:date>
    <item>
      <title>Power BI and Personio API: Dynamic single-use token</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-and-Personio-API-Dynamic-single-use-token/m-p/2441307#M35375</link>
      <description>&lt;P&gt;Hey all!&amp;nbsp;&lt;/P&gt;&lt;P&gt;First post here &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I'm trying to connect our Personio account API as a data source for our Power BI.&lt;/P&gt;&lt;P&gt;Context is, Personio API requires a CLIENT_ID and a SECRET whit which generates a single use token (Bearer). That Bearer is used in a separate call to access the data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;Now, I managed to get the token in DAX using:&lt;BR /&gt;= let&lt;BR /&gt;&amp;nbsp; &amp;nbsp; body = "&amp;nbsp; &amp;nbsp; &amp;nbsp; {""client_id"":""XXXXX"",""client_secret"":""ZZZZZ""}",&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Data= Web.Contents("URL_/auth?",[Content=Text.ToBinary(body),Headers=[#"Content-Type"="application/json"]]),&lt;BR /&gt;DataRecord = Json.Document(Data),&lt;BR /&gt;Bearer=DataRecord[data][token]&lt;BR /&gt;in&lt;BR /&gt;Bearer&lt;BR /&gt;&lt;BR /&gt;This successfully returns the single-use token (Bearer) and upon every "refresh" brings a new one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I'm stuk in passing that Bearer to the next API call to retrieve the data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions??&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 06 Apr 2022 16:39:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Power-BI-and-Personio-API-Dynamic-single-use-token/m-p/2441307#M35375</guid>
      <dc:creator>prodoreda</dc:creator>
      <dc:date>2022-04-06T16:39:21Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI and Personio API: Dynamic single-use token</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-and-Personio-API-Dynamic-single-use-token/m-p/2448805#M35458</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/375908"&gt;@prodoreda&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Firstly, try to get data by Web connector and you need to add Bear token in HTTP request header parameters(Authorization) in Advanced.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RicoZhou_3-1649664457882.png" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/697778i4359922045AB8C64/image-size/large?v=v2&amp;amp;px=999" role="button" title="RicoZhou_3-1649664457882.png" alt="RicoZhou_3-1649664457882.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Then open Advanced Editor in Power Query Editor and replace the token by your token Query.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RicoZhou_1-1649664376202.png" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/697776i7D3952E70A933F11/image-size/large?v=v2&amp;amp;px=999" role="button" title="RicoZhou_1-1649664376202.png" alt="RicoZhou_1-1649664376202.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Result is as below. Each time you refresh the report will get the new token from token query.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RicoZhou_2-1649664404658.png" style="width: 999px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/697777iC908D237A5405CAF/image-size/large?v=v2&amp;amp;px=999" role="button" title="RicoZhou_2-1649664404658.png" alt="RicoZhou_2-1649664404658.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;For more details, you may refer to this &lt;A href="https://www.youtube.com/watch?v=N8qYRSqRz84" target="_self"&gt;video&lt;/A&gt;&amp;nbsp; to learn more details.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;BR /&gt;Rico Zhou&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2022 08:11:00 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Power-BI-and-Personio-API-Dynamic-single-use-token/m-p/2448805#M35458</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-04-11T08:11:00Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI and Personio API: Dynamic single-use token</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-and-Personio-API-Dynamic-single-use-token/m-p/2448832#M35459</link>
      <description>&lt;P&gt;Hey, thanks for your reply&amp;nbsp;@Anonymous&lt;/a&gt;&amp;nbsp;!!&lt;/P&gt;&lt;P&gt;I was able to spare some time during the weekend and four a way to make it work:&lt;BR /&gt;let&lt;BR /&gt;Source = let&lt;BR /&gt;body = "{""client_id"":""XXXXXXX"",""client_secret"":""ZZZZZZZ""}",&lt;BR /&gt;Data= Web.Contents("&lt;A href="https://api.URL.com/auth" target="_blank"&gt;https://api.URL.com/auth&lt;/A&gt;?",[Content=Text.ToBinary(body),Headers=[#"Content-Type"="application/json"]]),&lt;BR /&gt;DataRecord = Json.Document(Data),&lt;BR /&gt;Bearer=DataRecord[data][token],&lt;BR /&gt;bearerBody = Web.Contents( "&lt;A href="https://api.URL.de/v1/company" target="_blank"&gt;https://api.URL.de/v1/company&lt;/A&gt;?",[Headers=[#"Accept"="application/json",#"Authorization"="Bearer "&amp;amp;Bearer]]),&lt;BR /&gt;employees = Json.Document(bearerBody)&lt;BR /&gt;&lt;BR /&gt;in&lt;BR /&gt;employees&lt;BR /&gt;&lt;BR /&gt;Basically I captured the response in a variable, then replicated the first call, changing the headers to include the "Authorization" and passing the variable to it.&lt;BR /&gt;&lt;BR /&gt;So far is still working with every refresh.&lt;BR /&gt;&lt;BR /&gt;I´ll check also your solution to see which one is faster &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 11 Apr 2022 08:24:30 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Power-BI-and-Personio-API-Dynamic-single-use-token/m-p/2448832#M35459</guid>
      <dc:creator>prodoreda</dc:creator>
      <dc:date>2022-04-11T08:24:30Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI and Personio API: Dynamic single-use token</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-and-Personio-API-Dynamic-single-use-token/m-p/2747254#M38386</link>
      <description>&lt;P&gt;I was looking for an option to access Personio via API and this one worked, however for a short time.&lt;BR /&gt;I was able to get data for several times from employees API with this approach and then investigated also grabbing data from time-offs API. Unfortunately, soon after I have not been able to get anyting and get an error that "we couldn't autheticate with the credentials" (I choose Anonymous, on the level of company). Strange thing is that the "Bearer" query to "auth" givesme the token, but somehow this now fails (though worked for a while).&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Here is full Query script I have used. Any help is appreciated. It could be, that Personio API is simply too unstable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;let&lt;BR /&gt;Source = let &lt;BR /&gt;body = "{""client_id"":""xxxxxxxxxxxxxxxxxxxxxxx"",""client_secret"":""yyyyyyyyyyyyyyyyyyyyy""}",&lt;BR /&gt;Data= Web.Contents("https://api.personio.de/v1/auth?",[Content=Text.ToBinary(body),Headers=[#"Content-Type"="application/json"]]),&lt;BR /&gt;DataRecord = Json.Document(Data),&lt;BR /&gt;Bearer=DataRecord[data][token],&lt;BR /&gt;bearerBody = Web.Contents( "https://api.personio.de/v1/company/employees?limit=200",[Headers=[#"Accept"="application/json",#"Authorization"="Bearer "&amp;amp;Bearer]]),&lt;BR /&gt;employees = Json.Document(bearerBody)&lt;BR /&gt;&lt;BR /&gt;in employees&lt;BR /&gt;in Source&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Do you have any similar experience?&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Sep 2022 08:37:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Power-BI-and-Personio-API-Dynamic-single-use-token/m-p/2747254#M38386</guid>
      <dc:creator>KaidoPowerBI</dc:creator>
      <dc:date>2022-09-05T08:37:45Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI and Personio API: Dynamic single-use token</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-and-Personio-API-Dynamic-single-use-token/m-p/2753544#M38479</link>
      <description>&lt;P&gt;Hi Kaido!&lt;/P&gt;&lt;P&gt;I got the same problem and what worked for me was to create 2 separate keys in personio: 1 for employees and 1 for Time-offs.&lt;BR /&gt;That way when calling the API it opens 2 separate end points with 2 different keys and has been working ever since.&lt;/P&gt;&lt;P&gt;Other thing is that I don't refresh all the queries at the same time but 1 by 1&lt;/P&gt;</description>
      <pubDate>Wed, 07 Sep 2022 15:56:50 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Power-BI-and-Personio-API-Dynamic-single-use-token/m-p/2753544#M38479</guid>
      <dc:creator>prodoreda</dc:creator>
      <dc:date>2022-09-07T15:56:50Z</dc:date>
    </item>
    <item>
      <title>Re: Power BI and Personio API: Dynamic single-use token</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Power-BI-and-Personio-API-Dynamic-single-use-token/m-p/3935615#M52704</link>
      <description>&lt;P&gt;Hey there,&lt;/P&gt;&lt;P&gt;thank you guys for your effort. I have tried adapting your solution, but to no success. Is this still working for you or do you happen to have any updated solutions?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2024 11:06:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Power-BI-and-Personio-API-Dynamic-single-use-token/m-p/3935615#M52704</guid>
      <dc:creator>PhilippM</dc:creator>
      <dc:date>2024-05-21T11:06:34Z</dc:date>
    </item>
  </channel>
</rss>

