GitHub user dosubot[bot] added a comment to the discussion: Warm up charts
cache via API
<!-- Answer -->
You don't need the `/api/v1/explore/` endpoint at all! The `warm_up_cache`
endpoint handles everything internally.
**Simplified workflow:**
Just call the warm up endpoint directly:
```bash
PUT /api/v1/chart/warm_up_cache
Content-Type: application/json
{
"chart_id": 1,
"dashboard_id": 123, // optional
"extra_filters": [] // optional
}
```
This endpoint [fetches the chart config, executes the query with `force=True`,
and stores the result in
cache](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/commands/chart/warm_up_cache.py#L37-L109)
automatically.
**Why you're getting 403:**
Your permissions target `ExploreFormdataRestApi` and `ExploreFormDataRestApi`,
but the `/api/v1/explore/` endpoint actually requires [`"Explore"` read
permissions](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/explore/api.py#L40-L42)
— that's a different permission class.
**Permissions needed for your simplified approach:**
For `/api/v1/chart/warm_up_cache`, you need [**"Chart" write
permissions**](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/charts/api.py#L133-L134):
```python
["Chart", "can_write"]
```
**Note:** If your charts use Row Level Security (RLS) or user-specific Jinja
macros like `current_user_id()`, cache keys are per-user. The [cache warmup
only benefits the user context that runs
it](https://github.com/apache/superset/discussions/34837#discussioncomment-14253167)
— other users won't get cache hits.
<!-- Dosu Comment Footer -->
*To reply, just mention
[@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=brand-link).*
---
<sup>How did I do?
[Good](https://app.dosu.dev/response-feedback/880bca1e-b21f-4ede-8391-105672e27dac?feedback_type=great_response&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-great_response)
|
[Irrelevant](https://app.dosu.dev/response-feedback/880bca1e-b21f-4ede-8391-105672e27dac?feedback_type=irrelevant_answer&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-irrelevant_answer)
|
[Incorrect](https://app.dosu.dev/response-feedback/880bca1e-b21f-4ede-8391-105672e27dac?feedback_type=incorrect_sources&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-incorrect_sources)
|
[Verbose](https://app.dosu.dev/response-feedback/880bca1e-b21f-4ede-8391-105672e27dac?feedback_type=too_verbose&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-too_verbose)
| [Hallucination](https://app.dosu.dev/response-feedback/880bca1e-b21f-4e
de-8391-105672e27dac?feedback_type=hallucination&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-hallucination)
| [Report
🐛](https://app.dosu.dev/response-feedback/880bca1e-b21f-4ede-8391-105672e27dac?feedback_type=bug_report&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-bug_report)
|
[Other](https://app.dosu.dev/response-feedback/880bca1e-b21f-4ede-8391-105672e27dac?feedback_type=other&utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=feedback-other)</sup>
[](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=chat-badge) [](https://cursor.com/link/prompt?text=You%20don%27t%20need%20the%20%60/api/v1/explore/%60%20endpoint%20at%20all%21%20The%20%60warm_up_cache%60%20endpoint%20handles%20everything%20internally.%0A%0A%2A%2ASimplified%20workflow%3A%2A%2A%0A%0AJust%20call%20the%20warm%20up%20endpoint%20directly%3A%0A%60%60%60bash%0APUT%20/api/v1/chart/warm_up_cache%0AContent-Type%3A%20application/json%0A%0A%7B%0A%20%20%22chart_id%22%3A%201%2C%0A%20%20%22dashboard_id%22%3A%20123%2C%20%20//%20optional%0A%20%20%22extra_filters%22%3A%20%5B%5D%20%20%20%20//%20optional%0A%7D%0A%60%60%60%0A%0AThis%20endpoint%20%5Bfetches%20the%20chart%20config%2C%20executes%20the%20query%20with%20%60force%3DTrue%60%2C%20and%20stores%20the%20result%20in%20cache
%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/commands/chart/warm_up_cache.py%23L37-L109%29%20automatically.%0A%0A%2A%2AWhy%20you%27re%20getting%20403%3A%2A%2A%0A%0AYour%20permissions%20target%20%60ExploreFormdataRestApi%60%20and%20%60ExploreFormDataRestApi%60%2C%20but%20the%20%60/api/v1/explore/%60%20endpoint%20actually%20requires%20%5B%60%22Explore%22%60%20read%20permissions%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/explore/api.py%23L40-L42%29%20%E2%80%94%20that%27s%20a%20different%20permission%20class.%0A%0A%2A%2APermissions%20needed%20for%20your%20simplified%20approach%3A%2A%2A%0A%0AFor%20%60/api/v1/chart/warm_up_cache%60%2C%20you%20need%20%5B%2A%2A%22Chart%22%20write%20permissions%2A%2A%5D%28https%3A//github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/charts/api.py%23L133-L134%29%3A%0A%60%60%60python%0A%5B%22Chart%22%2C%20%22can_write%22%5D%0
A%60%60%60%0A%0A%2A%2ANote%3A%2A%2A%20If%20your%20charts%20use%20Row%20Level%20Security%20%28RLS%29%20or%20user-specific%20Jinja%20macros%20like%20%60current_user_id%28%29%60%2C%20cache%20keys%20are%20per-user.%20The%20%5Bcache%20warmup%20only%20benefits%20the%20user%20context%20that%20runs%20it%5D%28https%3A//github.com/apache/superset/discussions/34837%23discussioncomment-14253167%29%20%E2%80%94%20other%20users%20won%27t%20get%20cache%20hits.) [](https://go.dosu.dev/discord-bot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-assistant&utm_content=join-discord) [](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/discussions/38718)
GitHub link:
https://github.com/apache/superset/discussions/38718#discussioncomment-16191237
----
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]