Forum Discussion
Web.Contents with complex Query parameter names
Hello,
I know what you mean but this is actually a custom function which I invoke from query where RangeStart and RangeEnd is applied.
(from_dt as text, to_dt as text) =>The problem I am facing is a syntax error on the below part where filter(HistoryDate;GREATEREQUALS) is not accepted as a parameter name.
Query=
[
filter(HistoryDate;GREATEREQUALS)=from_dt,
filter(HistoryDate;LESS)=to_dt,
]
here is my Web.contents code using queries "filter and select", it worked well for.
url = "https://api.MySite.com",
/*my variables - no URL encoding needed*/
Address = "555 Jones rd",
timestp = "2022-02-06T16:55:14-05:00",
/*Headers*/
headers = [#"Content-Type"="Applition/json",
#"Accept"="application/json, text/plain, */*",
#"Authorization"=Token,
#"Origin"="https://MySite.com",
#"Referer"="https://MySite.com/",
#"sec-ch-ua"= """Not_A Brand"";v=""99"", ""Google Chrome"";v=""109"", ""Chromium"";v=""109""",
#"sec-ch-ua-mobile"="?0",
#"sec-ch-ua-platform"="Windows",
#"Sec-Fetch-Dest"="empty",
#"Sec-Fetch-Mode"="cors",
#"Sec-Fetch-Site"="same-site",
#"User-Agent"="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36"
],
/*Relative Path*/
RPath = "odata/Addresss",
/*Queries*/
query =[#"$select"="id,shipto,ReferenceId,customer,facilityId",
#"$filter"=" contains(ReferenceId, '"&Address&"')", /*Variable Contatenation is occuring on this line*/
#"$top"="15",
#"timestamp" = timestp
],
web = Json.Document(Web.Contents(url, [Headers=headers, RelativePath=RPath, Query=query] )),
value = web[value],
hope it helps
- JasonMc2 years agoNew Member
Thank you for this, it helped resolve my issue. I was getting 'invalid identifier' on the $ symbol.
Using this format stopped the error. #"$select"