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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
ziyabikram96
Helper V
Helper V

Web Api dataset Scheduled Refresh

Hi,

I am working on Web Api dataset Scheduled Refresh with Chris Webb's blogs as guidance. In one of his blogs, he has suggested to use Relative Path and Query options to achieve the desired goal. I am using following code to import the data in JSON Format. 

=let

Contents = "{ ""recordsAfterDateTime"": ""2020-11-30T00:00:00"",

                          ""recordsBeforeDateTime"": ""2020-12-24T23:59:59.999"" }",

Source = Json.Document(Web.Contents("https://api.trulinks.co.uk",[RelativePath = "analysis-reports/v1/api/driver-d14",Query = [q="date"]],

[Headers=[#"TT-Api-Key"="abcd", #"Ocp-Apim-Subscription-Key"="abcd",#"Content-Type" = "text/json"],Content = Text.ToBinary(Contents)]))

in

Source

 

But, i am getting this error3 arguments were passed to a function which expects between 1 and 2.

I am a noob in M language so help needed to sort out this issue. Thanks!

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

let
Contents = "{ ""recordsAfterDateTime"": ""2020-11-30T00:00:00"",""recordsBeforeDateTime"": ""2020-12-24T23:59:59.999"" }",
Source = Json.Document(Web.Contents("https://api.trulinks.co.uk",[
RelativePath = "analysis-reports/v1/api/driver-d14",
Query = [q="date"],
Headers=["TT-Api-Key"="abcd", "Ocp-Apim-Subscription-Key"="abcd","Content-Type" = "text/json"],
Content = Text.ToBinary(Contents)

]
))
in
Source

View solution in original post

4 REPLIES 4
lbendlin
Super User
Super User

let
Contents = "{ ""recordsAfterDateTime"": ""2020-11-30T00:00:00"",""recordsBeforeDateTime"": ""2020-12-24T23:59:59.999"" }",
Source = Json.Document(Web.Contents("https://api.trulinks.co.uk",[
RelativePath = "analysis-reports/v1/api/driver-d14",
Query = [q="date"],
Headers=["TT-Api-Key"="abcd", "Ocp-Apim-Subscription-Key"="abcd","Content-Type" = "text/json"],
Content = Text.ToBinary(Contents)

]
))
in
Source

@lbendlin  Thanks a lot!

lbendlin
Super User
Super User

Web.Contents(url as text, optional options as nullable record) as binary

You provided multiple records. All your options need to be enumerated in the same record. 

 

@lbendlin  It is returning an error : "Token RightBracket Expected". Can you please show me how to code it according to my query in the question? I would highly appreciate that. Thanks!

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors