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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Dynamic REST api query

I am trying to replicate the below method to implementing query folding in using service now rest API in power bi desktop

https://sqldusty.com/2020/05/20/power-bi-incremental-refresh-with-web-api-data-source/

 

Service now encodes the date parameter like this :-

sysparm_query=sys_created_on%3E%3Djavascript%3Ags.dateGenerate('2020-05-01'%2C'00%3A00%3A00')
now I am getting the "Token Comma Expected" error just after sys_created_on in the query below
 

(dtquery as text)=>

let

Source= Json.Document(Web.Contents("https://servicecentral.xxx.com/api/now/table/prolem",
[Query=sysparm_query=sys_created_on%3E%3Djavascript%3Ags.dateGenerate(dtquery)]))

#"Converted to Table" = Table.FromList(Pagination, Splitter.SplitByNothing(), null, null, ExtraValues.Error)

in
#"Converted to Table"

what is wrong here?

 

 

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

@Anonymous - You are missing a comma after your first line (Source)

 

(dtquery as text)=>

let

Source= Json.Document(Web.Contents("https://servicecentral.xxx.com/api/now/table/prolem",
[Query=sysparm_query=sys_created_on%3E%3Djavascript%3Ags.dateGenerate(dtquery)])),

#"Converted to Table" = Table.FromList(Pagination, Splitter.SplitByNothing(), null, null, ExtraValues.Error)

in
#"Converted to Table"



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler thanks for the reply, My query is returning the same error even after putting a comma as you mentioned.

 

[Query=sysparm_query=sys_created_on%3E%3Djavascript%3Ags.dateGenerate('2020-05-01'%2C'00%3A00%3A00')])),

the red'%' value is where its showing as "Token Comma Expected"

@Anonymous - Pretty sure your syntax for the Query parameter is way off. 

 

https://blog.crossjoin.co.uk/2016/08/16/using-the-relativepath-and-query-options-with-web-contents-in-power-query-and-power-bi-m-code/

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.