web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to convert API cal...
Power Apps
Unanswered

How to convert API call with credentials

(0) ShareShare
ReportReport
Posted on by 601

Dear, 

I have a Dataverse DataFlow that connects to a third party API, which uses simple authentication.

In the first part, I get the accesstoken by putting my email address and password in the body:

AccessToken = let
 GetJson = Json.Document(Web.Contents("https://xxxxx.com/api/v2/users/me/login", [Headers=[Accept="application/json", #"Content-Type"="application/x-www-form-urlencoded;charset=UTF-8"], Content=Text.ToBinary("email=xxxxxxxxxx&password=xxxxxxxxxxx")])),
 data = GetJson[data],
 #"Converted to Table" = Record.ToTable(data),
 #"Filtered Rows" = Table.SelectRows(#"Converted to Table", each [Name] = "accessToken"),
 Value = #"Filtered Rows"{0}[Value]
in Value

In the second part, I use the accesstoken to call an API request:

let
 AccesTokenvalue = AccessToken,
 Source = Json.Document(Web.Contents("https://xxxxxxxx.com/api/v2/getdata", [Headers=[Authorization="Bearer " & AccesTokenvalue]])),
 data = Source[data]
 in
 data
in
 data;

How can I convert this to a query where the credentials can be taken out of the query code, so that the password can remain hidden for users looking into the query?
Thanks,

Koen

Categories:
I have the same question (0)
  • KoJaPD Profile Picture
    601 on at

    Hi Pat,

     

    Would that mean that I somehow save the result of the first "accesstoken" dataflow somewhere in Dataverse? And then I should use that in the "real" dataflow?

    If that's the case, I have not yet found a way to call Dataverse data in a dataflow, I probably missed the correct documentation for that somehow; can you point me to documentation / examples of your suggestion?

     

    The token is only valid for a two minutes; I need to call the API every five minutes...

     

    Thanks,Koen

  • KoJaPD Profile Picture
    601 on at

    Hi Pat,
    Regardless of the fact it will not help in this particular case, I am still curious how you would "use the output" of one dataflow in another dataflow? Where would you store this output, and how would you fetch it in the other dataflow?
    I will continue looking for another solution for my original question.

    Thanks,

    Koen

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 1,055

#2
Valantis Profile Picture

Valantis 666

#2
11manish Profile Picture

11manish 666

Last 30 days Overall leaderboard