HTTP API '404 Not Found' for /api/datasource/uid/cache

  • What Grafana version and what operating system are you using?
    Version 11.2.1

  • What are you trying to achieve?
    Trying to get a response on HTTP API for path /api/datasource/:uid/cache for a particular datasource.

  • How are you trying to achieve it?
    Have a python script to send a HTTP GET request. Script runs fine for other API endpoints, such as collecting the datasource UIDs, but this path seems to fail for me. I am changing the uid part of the cache path with the actual datasource UID.

  • What happened?
    I get the following error:

logger=context userId=12 orgId=1 uname=sa-1-datasource_automation t=2025-01-22T10:27:08.839383927Z level=info msg=“Request Completed” method=GET path=/api/datasources/feakn3lklcsg0a/cache status=404 remote_addr=removed time_ms=13 duration=13.956432ms size=24 referer= handler=notfound status_source=server

Error{“message”:“Not found”}

404
Traceback (most recent call last):
File “grafana_cache_check.py”, line 22, in
print(response.raise_for_status())
File “/usr/lib/python3/dist-packages/requests/models.py”, line 943, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://IPremoved/api/datasources/beakn3oygwfswf/cache

Hmmm, I was not able to reproduce. Do you by chance have any characters in your UID that would need escaping? Does this error for you for all datasources or a specific one?