Warning: If you are not using the Query parameter to Web.Contents, your query may have errors when refreshing. This pattern may have trouble.
let
/* this pattern can fail */
category = "furniture",
tag = "sale",
response =
Web.Contents(
"https://www.website.com/api/"
& "query?category="
& category
& "&tag="
& tag
)
in
response
Instead pass query arguments in the query record
For all options, see: https://docs.microsoft.com/en-us/powerquery-m/web-contents#syntax
Example: using www.foo.com/api/newest?year=2020&sort=ascending
let
response =
Web.Contents(
"http://www.foo.com",
[
RelativePath = "api/newest",
Query = [
year = 2020,
sort = "ascending"
]
]
)
in
response
Web.Contents(url as text, optional options as nullable record) as binary
The url argument of Web.Contents expects a static url. The Service tests the url parameter by stripping out url query strings.
