Deploy widgets into Dashboard from API CAL

Hello, over here again!

I want to know if there is any way to deploy widgets from API call.

curl -X POST
http://localhost:5000/api/dashboards
-H “Content-Type: application/json”
-H “Authorization: Key xxxxxxxxxxxxxxxxxxxxxx”
-d ‘{“name”: “DICCIONARIO DE DATOS”}’

Currently I am displaying the dashboard without problems, but I still can’t get something about the widgets!

I have 2 queries for the dashboad, one with a parameter and the other without a parameter.

Technically it’s possible but it’s not documented. The easiest way to learn it is to either examine the source code for the WidgetListResource or to open your browser’s network inspector and spy on the requests as you set up a dashboard manually.

If you’re just making copies of dashboards, you should consider using redash-toolbelt which already has a script to do this automatically.

Great jessie, i will review the 2 ways. Actually the goal is to be able to implement the dashboard from the api call automatically.

If you have something of the json format of the first option, I would really appreciate it.

here I leave the json example to add the widgets for api call

{“options”:{
“parameterMappings”:{},
“isHidden”:false,
“position”:{
“autoHeight”:true,
“sizeX”:3,
“sizeY”:14,
“minSizeX”:2,
“maxSizeX”:6,
“minSizeY”:1,
“maxSizeY”:1000,
“col”:0,
“row”:0}
},
“text”:"",
“width”:1,
“dashboard_id”: id_dashboad,
“visualization_id”:id_vizualitation}

thanks jessie, it is correct the information was there, in WidgetListResource.

1 Like

Glad you found it and thank you for sharing your solution!