Forum Discussion
luckygirl
1 year agoHelper I
Web.Contents Query parameter - multiple filed values for one parameter
Hi I am trying to specify multiple filed values for one parameter. I had a look at a similar post. https://community.fabric.microsoft.com/t5/Desktop/Web-Contents-Query-parameter-multiple-paramet...
- 1 year ago
The below code worked for me.
= let // List of subjects subjects = { "TEST1", "TEST2" }, // Function to fetch data for a single subject getDataForSubject = (subject as text) => let queryParams = [ #"per_page" = "100", #"and[display_collection][]" = "test", #"sort" = "date", #"direction" = "desc", #"and[subject][]" = subject, #"APIToken" = "123" ], source = Json.Document(Web.Contents("http://api.test.org/v1/records.json?", [Query = queryParams])) in source, subjectQuery = List.Transform(subjects, each getDataForSubject(_)) in subjectQuery
lbendlin
1 year agoSuper User
is the "and" really part of the specification?
The usual approach for multiple values is to specify the query parameter multiple times
...&subject=Test1&subject=Test2&APIToken=123
- luckygirl1 year agoHelper I
Thanks, it doesn't work. "The name 'and[subject][]' is defined more than once". According to this blog post Chris Webb's BI Blog: Handling Multiple URL Query Parameters With The Same Name Using Web.Contents In Power Query/Power BI it should work. Can't figure out the reason.