Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
So im dealing with an Rest Api that has a 900 second expiration.
I have tried creating a function that could be called on once DateTime.LocalNow() > Expiration ( which is DateTime.LocalNow()+duration(0,0,0,900) upon receiving the first Auth token) that would push a new Auth token into a loop (because the data is paginated with a low limit of rows per a pull ... its 50). im needing to pull the entire data set which takes more then the 15 min time window the rest api allows. Any suggestions or ideas would be very helpful =D
The Error i get after 900 seconds is We couldn't authenticate with the credentials provided. Please try again
The current Fx im using to attempt to get the new Auth token is
(Authcode as text) =>
let
body2 = "*****",
Data=Json.Document(Web.Contents("https://xxxxxxx", [RelativePath= "xxxxxxxx" ,Headers=[#"Content-Type"="application/x-www-form-urlencoded"], Content=Text.ToBinary(body2)])),
FormatAsJson = Json.Document(Data),
access_token1 =Data[access_token],
access_tokenHeader= "Bearer "& access_token1
in if Authcode = access_tokenHeader then getNewAuth(Authcode) else access_tokenHeader
The code leading up to this looks like this
Source2 = if getTime() > Endtime then getNewAuth(Authcode)
else Authcode,
That line of code is withen another fx loop due to pagination
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
97 | |
95 | |
76 | |
72 | |
65 |
User | Count |
---|---|
140 | |
109 | |
103 | |
82 | |
73 |