I’m in a process to migrate from one Redash environment to another, which is a copy from the original already created. I was successful in the migration of the Queries and Visualizations, but not with the Dashboards and Widgets so far.

I’m using the v8 of Redash on both environments, and to migrate from one to another i’m using the migrator script: migrator.py

The issue is with the Widgets creation, since i can migrate succesfully the dashboards alone.

What i’m trying to do, is create first the Dashboard via post in the destination, and afterwards in the same process of the script, create the Widgets of that Dashboard. I’m using pretty much the same structure provided in the migrator script, with some logic modifications and adaptations for our case.

The error tha i’m facing is

500 Server Error: INTERNAL SERVER ERROR for url: https://my-domain//api/widgets

Like occured with the visualizations of the queries, the parameters i’m using are the parameters provided from the migrator script, once the documentation doesn’t specify which are able to use. And also, differently from the dashboards and queries, i cant access the visualizations and widgets API path(eg. url: …api/widgets), of which i believe is designed this way.

In this situation my progress is being determined by trial and error, suspecting for a long time that this issue may be occuring by incorrect parameter sending, via the request post method. Because using the Redash-API-Client, i’m succesfully inserting/creating the Widgets in the desired Dashboard.

Would anyone know the probable cause for this issue to be happening? Or is there some documentation about widgets POST method, including the necessary parameters to be send?

Thanks in advance.

The widgets API isn’t documented but it should be possible to POST a widget object from one instance into another one, unmodified. I notice that your error message shows a double forward slash between my-domain and api/widgets. Is this a typo?

No it’s not a typo, it was intentional. Once i noticed that the redash api client post included this additional slash, i though in add it. It seems that it doesn’t chance anything, since i did it with the POST of the visualizations and both double slash and single slash resulted in the same.
Regarding the widgets insertion via POST, i’m using the following structure to send to the destination:

“dashboard_id”: dash_id,
“options”: dash_options,
“width”: dash_width,
“text”: dash_text,
“visualization_id”: dash_v_id

The dashboard_id parameter i’m getting via GET from the destination, and than after that, i’m inserting the Widget in the location. So initially i insert the Dash via POST, then i GET the id from the Dash inserted in the destination, and finally i use the collected id to insert by POST, the Widget of that Dashboard into it.

Do you think i’m using the correct structure to send via POST? For a while i though that maybe the parameters could be causing this error. Since the same ERROR 500, that i was facing with the visualizations, was solved by the use of the correct parameters to do the POST.

To send the widget to the Dash i’m using the id of it, but wouldn’t be the “slug” the id of that Dash? Shouldn’t i be sending the slug instead?

In this migration process i did archive a significant quantity of objects(Dashboards, queries, especially queries), and running out of ideas of the possible cause, i thought that maybe it could be interfering and causing the error that i’m facing. But sincerelly, i don’t think it is the number of archived objects that is causing this situation.

Would you recommend any other way to migrate the widgets instead of this one that i’m trying currently?
I really don’t know what i’m doing wrong, bu so far i’m not succeding with the task this way.

Thanks for the reply.

I find out that the issue was really with the parameters.