user-1
(User 1)
October 25, 2024, 7:15pm
1
This topic was automatically generated from Slack. You can find the original thread here .
In HTTP requests, is there any support for the same query parameter being repeated? I tested this and it seems to ignore all but one of the values. The api I’m calling is Retrieve Email Statistics for Categories | SendGrid Docs | Twilio and I’m trying to pass two values such as https://api.sendgrid.com/v3/categories/stats?categories=email1&categories=email2…
. I assume this can only be accomplished with a code step.
user-1
(User 1)
October 25, 2024, 7:15pm
2
Try this: ?categories[]=email1&categories[]=email2
user-1
(User 1)
October 25, 2024, 7:15pm
3
Sorry, I didn’t specify that I was trying in the UI
user-1
(User 1)
October 25, 2024, 7:15pm
4
the resulting call ignores all but the last categories parameter
user-1
(User 1)
October 25, 2024, 7:15pm
5
Yeah, try adding the brackets afterwards.
user-1
(User 1)
October 25, 2024, 7:15pm
7
i also tried adding brackets after on separate lines but that fails on the other end saying missing the parameter entirely
user-1
(User 1)
October 25, 2024, 7:15pm
8
for now, i can do it in code or in separate calls, just wondering if it’s possible without doing that
user-1
(User 1)
October 25, 2024, 7:15pm
9
Looks like this might be a bug in how Pipedream handles the parameters.
user-1
(User 1)
October 25, 2024, 7:15pm
10
Interestingly enough, Zapier won’t let you do this either. They automatically dedup the parameters if you add the same one more than once - adding numbers after
user-1
(User 1)
October 25, 2024, 7:15pm
11
: Yeah, this is pretty easy to reproduce with a workflow that calls itself (warning: don’t deploy this as it will create an infinite loop! )
user-1
(User 1)
October 25, 2024, 7:15pm
12
Looks like there’s no standard way of doing this though !
I always assumed using square brackets was a standard. :man-facepalming:
user-1
(User 1)
October 25, 2024, 7:15pm
13
Ya, I have definitely seen it done a few different ways
user-1
(User 1)
October 25, 2024, 7:15pm
14
can’t remember which api it was but some one that URI encoded the comma between values such as ?cars=Saab%2CAudi
user-1
(User 1)
October 25, 2024, 7:15pm
15
or maybe it was a pipe :rolling_on_the_floor_laughing:
user-1
(User 1)
October 25, 2024, 7:15pm
16
I wonder if it’s an axios thing
import fetch from "node-fetch";
export default defineComponent({
async run({ steps, $ }) {
return await fetch("https://eochz1eod3cid1k.m.pipedream.net?test=value1&test=value2");
},
});
user-1
(User 1)
October 25, 2024, 7:15pm
17
Our HTTP action uses axios, but above I’m using node-fetch
user-1
(User 1)
October 25, 2024, 7:15pm
19
FYI: You don’t need to import node-fetch
anymore.
It’s native now (experimental since version 18 , and stable since version 21 ).