AbrarA
BuildShip2y ago
5 replies
Abrar

Validating the existence of query string parameters

So I'm relaying a call to an api which accepts a bunch of optional query params....

When i make the API call... I try to pass on the query params like so...

{
  "key" : (await getSecret("openaustralia-key")),
  "date" : ctx["root"]["request"]["query"].date,
  "party" : ctx["root"]["request"]["query"].party,
  "state" : ctx["root"]["request"]["query"].state,
  "search" : ctx["root"]["request"]["query"].search
}


I'm looking for a simple in-line way to validate the existence of each param, and only then and only populate the value..

Does anyone know how to do this in a clean and efficient manner?

(NB: im not a javascript guru)
Thanks in advance
Solution
Alternately you can use the API call to pass multiple parameter at one to your API
image.png
Was this page helpful?