Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot Pass Multiple Values to Dynamic Variable via API Due to JSON Payload Structure #6436

Open
aashishvanand opened this issue Sep 8, 2023 · 0 comments

Comments

@aashishvanand
Copy link

aashishvanand commented Sep 8, 2023

Description:

When using the API to pass values to a query that uses a dynamic field (which is defined as a query-based dropdown list with multiple values allowed), it seems that the current JSON payload structure restricts the ability to pass multiple values for that dynamic field.

Reproduction Steps:

  1. Create a query with the following structure:
{
  "collection": "collectionA",
  "aggregate": [
    {
      "$match": {
       "field1": {
          "$in": ["{{dynamic_field}}"]
        }
      }
    }
  ]
}
  1. Use Postman or curl to make a request to the query results API with the following payload:
curl --location 'https://redash.domain.app/api/queries/1/results' \
--header 'Authorization: xxxxxxx' \
--header 'Content-Type: application/json'  \
--data '{ 
    "parameters": {
     "dynamic_field": "ABC123"
    }
}'
  1. Try to pass multiple values for dynamic_field, e.g., "dynamic_field": ["ABC123","DEF456"].

Expected Behavior:

The query should understand multiple values for dynamic_field and process them correctly.

Actual Behavior:

Due to the JSON payload structure, the query does not understand how to handle an array of values for dynamic_field.

Workaround:

None found. Limited to one query at a time.

Environment:

  • Redash Version: 10.1.0
  • Browser/OS: Any
  • How did you install Redash: Docker, Ubuntu 22, AWS.
  • Database: MongoDB 6.x

Additional Context:

The inability to pass multiple values restricts the utility of the dynamic fields when using the API, particularly for MongoDB queries that may require multiple matching criteria.

Thank you for looking into this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant