Query params in variable

I’ve been searching for a while but haven’t found an answer. Hoping it’s something simple. We use NetSuite, and in trying to interact with NetSuite I have a URL that already has query params on it, i.e. https://######.app.netsuite.com?script=####&deploy=1&compid=######. This is the base URL I would use for all of my calls in the collection so I would like to set it as a variable. However, when I do this and try to use it on a call, the params tab doesn’t seem to work because it doesn’t like that there isn’t a question mark in the URL (since it’s already in the variable). Is there a correct way to do this? I’ve attached a couple screenshots for reference.

Thanks in advance!

If I change the first ampersand to a question mark the params tab populates correctly, but the call fails.

The ? indicates the start of the query string.

Within the query string you have a set of key=value pairs, each separated by an &.

That’s not really a base URL if it includes the ? denoting the start of the query string and 3 key\value pairs.

It looks like you will need to reduce the base URL to the hostname, and then include the script, deploy and compid as proper query parameters.

As far as I’m aware, Postman only really reads the variables when the request is run, which is why it can’t tell if it already includes the question mark.

The position of query parameters don’t generally matter, so you could do something like the following.

It will try and put an equals sign on the end of the URL, but you can just delete that manually, and it will just read the baseParams as a string.

1 Like

That’s interesting, I hadn’t thought of doing it that way, though it makes sense.

Yeah, unfortunately I understand everything you’re saying, it’s just the way NetSuite works it’s a little different than your typical use case because you have to target a specific script running on their side, which is specified via their own URL parameters, which you can then expand upon. So while I agree, it’s not really a “base URL” in the typical sense, every call I make is going to have the same URL and handful of NetSuite-specific params, so it would be great not to have to list those same params over and over and over in every call I create.

That said, I think this baseParams concept could work though. Thanks for the idea!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.