Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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 error: 3 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!
Solved! Go to Solution.
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
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
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!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
100 | |
75 | |
73 | |
49 |
User | Count |
---|---|
145 | |
109 | |
109 | |
90 | |
64 |