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
luckygirl
1 year agoHelper I
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
subjectQuerylbendlin
1 year agoSuper User
you should not include the question mark in the URL.