Get certified for free when you join Fabric Data Days 2026 and dive into Fabric, Power BI, SQL, AI, and other essential data skills.
Join nowJuly 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more
Hey fellow users of Power Bi,
I need to generate an API key ever 60min when I want to use this api.
In order to generate the API key I need to throw a POST after https://XXXXXXXXXXXXX.com/oauth2/token and I need to fill out an email and a password in the Body along with setting a header named Content-Type to application/x-www-form-urlencoded
Header:
Content-Type = application/x-www-form-urlencoded
Body:
email = [email protected]
password = xxxxxxx
How can I do this in the advanced editor?
I have looked at a couple of different examples but I havnt been able to do this successfully yet.
Best regards
You can create a new blank query and use Web.Contents().
Reference:
https://docs.microsoft.com/en-us/powerquery-m/web-contents
https://docs.microsoft.com/en-us/power-query/web.contents
Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I just dont get how I specify the body, I have seen countless examples of the header, but whenever I try to implement the body it goes wrong :S?
You may refer to this similar thread: https://community.powerbi.com/t5/Integrations-with-Files-and/Dataset-Refresh-REST-API-amp-JSON-with-....
Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@v-yuta-msft wrote:
You may refer to this similar thread: https://community.powerbi.com/t5/Integrations-with-Files-and/Dataset-Refresh-REST-API-amp-JSON-with-....
Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hey there,
I have gotten a bit further as follows:
let
Source = Json.Document(Web.Contents("https://api.xxxxx.dk/oauth2/token",
[Headers=[#"Content-Type"="application/x-www-form-urlencoded"],
Content=Text.ToBinary(Uri.BuildQueryString([grant_type="password", client_id="XXXXXXXXXXXXXXXXXXXXX", client_secret="XXXXXXXXXXXXXXXXXX", email="[email protected]", password="XXXXXXX!"]))]))
in Source
However now I am getting the following error:
I spoke with the people who have made the API and they said they think "Json.Document" expects the return in json-format, however for /oauth2/token it is not as they are using the OAUTH standard. Can you help me make the above possible without the use of "Json.Document"?
Best regards 🙂
Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.
Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.
| User | Count |
|---|---|
| 16 | |
| 14 | |
| 9 | |
| 8 | |
| 8 |
| User | Count |
|---|---|
| 32 | |
| 29 | |
| 27 | |
| 25 | |
| 25 |