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
v-saisrao-msft
1 year agoCommunity Support
Hi luckygirl,
I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.
Thank you.
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
subjectQuery- lbendlin1 year agoSuper User
you should not include the question mark in the URL.