GitHub user dosubot[bot] added a comment to the discussion: Filtered Chart Data via API
<!-- Greeting --> Hi @satanic-panic! I'm [Dosu](https://go.dosu.dev/dosubot) and Iām helping the superset team. <!-- Answer --> Yes, you can filter chart data directly via the `/api/v1/chart/data` API endpoint by sending a POST request with a JSON payload. In your payload, include a `filters` array inside the `queries` list, where each filter specifies the column (`col`), operator (`op`), and value (`val`). Supported operators include `==`, `LIKE`, `ILIKE`, `IN`, and more. Here's a minimal example for filtering by equality and LIKE: ```json { "datasource": "your_table_or_dataset_id__table", "queries": [ { "filters": [ { "col": "ID", "op": "==", "val": 123 }, { "col": "NAME", "op": "LIKE", "val": "%foo%" } ] } ] } ``` Replace `"your_table_or_dataset_id__table"` with your actual datasource identifier. The `filters` array can include as many filter objects as you need, using any supported operator. Jinja templating and dashboard filters do not interact directly with this API call. Jinja is only relevant if you use it in the `where` or `having` clauses in the `extras` field of your query object, but for most use cases, specifying filters as shown above is the most straightforward approach for API-based filtering. For more details, see the [relevant code and schema](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/charts/schemas.py) and [discussion on API usage](https://github.com/apache/superset/discussions/32117#discussioncomment-12041271). <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/e4347900-eed7-4dda-bc7d-de563b3a3983?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/e4347900-eed7-4dda-bc7d-de563b3a3983?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/e4347900-eed7-4dda-bc7d-de563b3a3983?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/e4347900-eed7-4dda-bc7d-de563b3a3983?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/e4347900-eed7-4dda-bc7d-de563b3a3983?feedback_type=hallucination) | [Report š](https://app.dosu.dev/response-feedback/e4347900-eed7-4dda-bc7d-de563b3a3983?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/e4347900-eed7-4dda-bc7d-de563b3a3983?feedback_type=other)</sup> [](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github)& nbsp;[](https://go.dosu.dev/discord-bot) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/34668) GitHub link: https://github.com/apache/superset/discussions/34668#discussioncomment-14091144 ---- This is an automatically sent email for [email protected]. To unsubscribe, please send an email to: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
