Passing dynamic query params to API resource

Hi @Eriks_Reks,

I did a little testing and found you are correct. It seems there is a bug which add a trailing =. See this

I did find a workaround using a JS query instead. Here is a sample to get you started:

const url = `https://api.hybiscus.dev/api/v1/items/api/items/${pathParam.value}?${queryParams.value}`;

const options = {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    // Add additional headers if needed
  },
  body: JSON.stringify({
    // Your body here
  }),
};

console.log("Request URL:", url);
console.log("Request Options:", options);

return fetch(url, options).then(res => res.json());

As you can see the request is now correct:
chrome_OC8NaPNSC5

I hope this helps!

1 Like