Forum Discussion
How to fetch Data from API with dynamic access token
Hello,
You can refer below blog to achieve this functionality-
https://www.advaiya.com/generate-dynamic-token-and-get-data-from-custom-api-in-power-bi/
Regards
Shruti Vyas
- vr_20203 years agoFrequent Visitor
shrutivyas06 - I was trying to use this code in Blank Query in Advance editor as per your blog and getting filed token not found. Looks like the API URL for token generation that I am trying to use in the following code seems to be wrong. Can you please help me with one sample API URL format that should be used in url = <<API Url for token generation>>
let
url = <<API Url for token generation>>,
headers = [#"Content-Type" = "application/json"],
postData = Json.FromValue([username="<<User Name>>",
password= "<<Password>>"]),
response = Web.Contents(
url,
[
Headers = headers,
Content = postData
]
),
Data = Json.Document(response),
access_token=Data[token]
in
access_token