Select to view content in your preferred language

It is possible to edit the JSON Dashboard using Python?

2877
3
02-06-2020 08:44 AM
Gustavo_Souza
Occasional Contributor

We use a dashboards with a lot of gadgets, which are very time consuming to make. We started using a JSON template and manipulating the code, and paste into a the Dashboard code on ArcGIS Online Assistant. Which is still time consuming. 

Recently I learned that I can edit the data of a item by using the code 

 gis.content.get(item.id).update(item_properties="text": data)    

Which data us the .JSON file. It works perfectly for Web Maps, when I use the code to replace the JSON. But it always give me an error if I try to replace the Dashboard .JSON of an existing dashboard.

In the same way, I can create web maps using the 

gis.content.add(item_properties="text": data)    

but when I create a dashboard, the error above appears.

An easy answer would be "My .JSON is invalid/broken/has errors", but if I use the code above to replace to the exact same json code of the current dashboard, it still changes to a functional dashboard to a broken one.

Maybe these codes are not suposed to be used on Dashboards. Then, how can I update the Dashboard Json using Python? Is there another way?

Tags (3)
0 Kudos
3 Replies
DerekLaw
Esri Esteemed Contributor

Hi Gustavo,

> It is possible to edit the JSON Dashboard using Python?

This is not a supported workflow. Sorry.

Based on the workflow you described, please vote for this enhancement request,

https://community.esri.com/ideas/14350 

Hope this helps,

ADClark
Occasional Contributor

I don't see this anywhere as an enhancement request but it has my vote!

0 Kudos
PeterMilenkovic
Frequent Contributor

You need to use item.update(data= NewJson) instead of add.(item_properties="text":data)

I do it in one of our dashboards as we need to dynamically update the date selectors when the data set is updated.

 

 

0 Kudos