Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
guigagliardi
New Member

Variable Token unnable to schedule refresh in Power Bi Service

I've been struggling with this API for a few days, where it needs to be executed in two steps:

  1. POST request to generate the Token, which is updated every 1 hour.
  2. GET request to fetch the content from the API.

When I run it in the Desktop, I have no problems getting the results. However, when I try to turn it into a Data Flow, I start receiving the following error:

guigagliardi_0-1690309927466.png

(

It's not possible to save the data flow.

One or more tables reference a dynamic data source)

.

When building it step by step, for the 1st step, the Service allows me to save. But when I execute the second step, that's where my problem lies. Below, I'll insert the codes.

Step 1

 

 

 

 

let 
            urltk = url_,
            cabecalhotk = [
                #"Accept"= "application/x-www-form-urlencoded", 
                #"Content-Type"="application/x-www-form-urlencoded"
            ],
            corpotk = [
                grant_type = "password",
                client_id = client_id_,
                client_secret = client_secret_,
                username = username_,
                password = password_
            ],
            corpoString = Uri.BuildQueryString(corpotk),
            corpoBinario = Text.ToBinary(corpoString),
            tokenResponse = Json.Document(
                Web.Contents(
                    urltk, 
                    [Headers = cabecalhotk, Content = corpoBinario]
                )
            ),
            Token1 = tokenResponse[access_token]
        in 
            Token1

 

 

 

 

 

Step 2

 

 

 

 

let
  url = url_api,
  tokentexto = Json.FromValue(Token),
  tokenconverte = Json.Document(tokentexto),
  cabecalho = [
            Accept = "application/json",
            Authorization = "Bearer " & Token
    ],
  FilterCriteriaAPI = [
        page = "1",
        pub_date_after = "2023-07-24",
        pub_date_before = "2023-07-24"
    ],
  queryStringAPI = Uri.BuildQueryString(FilterCriteriaAPI),
  urlCompletaAPI = url & "?" & queryStringAPI,
  responseAPI = Json.Document(Web.Contents(urlCompletaAPI, [Headers = cabecalho])),
  resultado = responseAPI[results],
  tabela = Table.FromRecords(resultado)
in 
  tabela

 

 

 

 

 

I don't know what else to do, I tried to apply the RelativePath, but for some reason, it cannot be accepted in Header's parameter.

Thanks

0 REPLIES 0

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.