cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Power Query API Source dynamic token

Hello All,

 

I would like to get the value from another table and past it as a filter on my Source(nextPageToken=&Value) on the screenshot below.

 

Nextpagetoke

Anyone could help me with the below problem?

 

 

 

Screen Shot 2020-03-20 at 5.17.03 PM.pngScreen Shot 2020-03-20 at 5.18.54 PM.png

 

Thank you,

 

Ann

1 ACCEPTED SOLUTION
Microsoft
Microsoft

Change that last step in your Value query to:

Value1{0}

or

List.First(Value1)

or

List.Single(Value1)

View solution in original post

4 REPLIES 4
Microsoft
Microsoft

Change that last step in your Value query to:

Value1{0}

or

List.First(Value1)

or

List.Single(Value1)

View solution in original post

**OK I should have read into the error, instead of assuming it was my dodgy code**

 

I ended up merging my two queries into one, causing PowerBi to prompt me about data source settings. I believe I ticked 'Anonymous'. Now my query works as expected.

 

For others, click on your query > data source settings > edit permissions > edit.

 

 

 

Hi @artemus 

 

I'm having a similar issue to the OP of this thread. Only, your suggested solutions aren't working 😞

 

My 'token' query:

 

 

let
    Source = Json.Document(Web.Contents("<url>", 
    [Headers=
    [<headers>]])),
    #"Converted to Table" = Record.ToTable(Source),
    Value = #"Converted to Table"[Value],
    token = Value{0}
in
    token

 

 

 

I successfully get a token:

 

 

eyJhbGciOiJSUzI1NiIsImtpZCI6ImQxMGM4ZjhiMGRjN2...

 

 

 

My 'get data' query:

 

 

let
    Source = Json.Document(Web.Contents("<url>", 
    [Headers=
    [#"xxx"="xxx",
    #"Authorization"= "Bearer " & token,
    #"Content-Type"="application/json"]]))
in
    Source

 

 

 

The error:

 

 

Formula.Firewall: Query 'get data' (step 'Source') references other queries or steps, so it may not directly access a data source. Please rebuild this data combination.

 

 

 

Any ideas what's wrong here?

 

Thanks

Use the RelativePath option to put the part of your URL after the domain. The url parameter must be a string literal or a direct reference to a parameter.

 

E.g.

 

Web.Contents("mydomain.com", [RelativePath = tokenUrl, Headers = [...]])

 

thank you!

Helpful resources

Announcements
secondImage

Happy New Year from Power BI

This is a must watch for a message from Power BI!

December Update

Check it Out!

Click here to read more about the December 2020 Updates!

Community Blog

Check it Out!

Click here to read the latest blog and learn more about contributing to the Power BI blog!

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors
Top Kudoed Authors