website icon indicating copy to clipboard operation
website copied to clipboard

API Docs and python redash client are wrong for dashboard API - should be id not slug

Open anshbansal opened this issue 3 years ago • 1 comments

Issue Summary

As per https://redash.io/help/user-guide/integrations-and-api/api the dashboard API is /api/dashboards/<dashboard_slug>. But as per the source code https://github.com/getredash/redash/blob/master/redash/handlers/dashboards.py#L155 it takes dashboard_id as parameter. I tested and dashboard_slug causes a 500 error while using dashboard_id gives response.

Steps to Reproduce

  1. Call /api/dashboards/<dashboard_slug> on Redash. Expected dashboard info for dashboard. Actual 5xx error.
           '    return self._get("api/dashboards/{}".format(slug)).json()\n'
           'File "/tmp/datahub/ingest/venv-51a06696-5d1a-44ba-83f1-3ddf66325603/lib/python3.9/site-packages/redash_toolbelt/client.py", line 203, in '
           '_get\n'
           '    return self._request("GET", path, **kwargs)\n'
           'File "/tmp/datahub/ingest/venv-51a06696-5d1a-44ba-83f1-3ddf66325603/lib/python3.9/site-packages/redash_toolbelt/client.py", line 213, in '
           '_request\n'
           '    response = self.session.request(method, url, **kwargs)\n'
           'File "/tmp/datahub/ingest/venv-51a06696-5d1a-44ba-83f1-3ddf66325603/lib/python3.9/site-packages/requests/sessions.py", line 529, in '
           'request\n'
           '    resp = self.send(prep, **send_kwargs)\n'
           'File "/tmp/datahub/ingest/venv-51a06696-5d1a-44ba-83f1-3ddf66325603/lib/python3.9/site-packages/requests/sessions.py", line 645, in '
           'send\n'
           '    r = adapter.send(request, **kwargs)\n'
           'File "/tmp/datahub/ingest/venv-51a06696-5d1a-44ba-83f1-3ddf66325603/lib/python3.9/site-packages/requests/adapters.py", line 510, in '
           'send\n'
           '    raise RetryError(e, request=request)\n'
           '\n'
           "RetryError: HTTPSConnectionPool(host='redash.MASKED_DOMAIN.com', port=443): Max retries exceeded with url: /api/dashboards/sc-metrics "
           "(Caused by ResponseError('too many 500 error responses'))\n"

Technical details:

  • Redash Version: https://github.com/getredash/redash/releases/tag/v10.1.0
  • Browser/OS:
  • How did you install Redash: Community member reported it for the OSS DataHub project. They are self-hosting. Ref https://github.com/datahub-project/datahub/pull/4985 where we figured this out.

anshbansal avatar May 24 '22 15:05 anshbansal

This is a good report, although technically there still exists an API endpoint that works with the slug. It uses the singular /dashboard API endpoint. It's referenced in the release notes here for V10. We'll update the documentation.

susodapop avatar Jul 05 '22 16:07 susodapop