Skip to content

[Bug]: API is broken when using dynamic query strings #36279

Open
@tomjose92

Description

Is there an existing issue for this?

  • I have searched the existing issues

Description

I have an API where I am conditionally sending query parameters based on some logic. So i created a function getSearchQueryParam in a JSObject Utils and the response of will return something like &searchString=<some-value>.
Now I am calling it directly inside the API along with other query parameters as page={{Table1.pageNo}}&size={{Table1.pageSize}}{{Utils.getSearchQueryParam()}}

But when i checked the evaluated value, it does not show the correct value and the entire string is just replaced by a ~

So then I have to make a workaround by using template literals instead, eg
{{ page=${Table1.pageNo}&size=${Table1.pageSize}${Utils.getSearchQueryParam()}}} and this show correctly and evaluated fine.

But I am forced to use this workaround which is not readable and I would prefer to use the moustache brackets for all my dynamic values

Attached screenshots below of the issue
Screenshot 2024-09-12 at 1 43 22 PM
and the workaround
Screenshot 2024-09-12 at 1 44 06 PM

Steps To Reproduce

  1. Create an API with an endpoint
  2. Add some query parameters like page and size binded with the a Table widgets pageNo and pageSize
  3. Create a JS function that returns a dynamic query string, eg searchString=test
  4. Now append that function directly in the API after the existing parameters, eg &page={{Table1.pageSize}}{{Utils.formatQueryString()}}

You will see that the API does not work as intended, and the evaluated value of the API is broken with a ~

Public Sample App

No response

Environment

Production

Severity

Medium (Frustrating UX)

Issue video log

No response

Version

Cloud

Metadata

Labels

BugSomething isn't workingIntegrations ProductIssues related to a specific integrationMediumIssues that frustrate users due to poor UXNeeds TriagingNeeds attention from maintainers to triageProductionQuery & JS PodIssues related to the query & JS PodREST API pluginREST API plugin related issues

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions