How to find the list names of active and deleted Dashboard in DHIS2 using either API or Customized APP

Dear Developer,

How to retrieve list of all active and deleted Dashboard names in DHIS2 including username of the person who deleted or created or updated the Dashboard. I have tried to use an API and failed.

Regards

1 Like

Hi @Shapr0019

Thanks for your question!

I was able to get some of the info you mentioned using an API request https://play.dhis2.org/2.38.2.1/api/dashboards?fields=id,name,href,createdBy,lastUpdatedBy;
however, it doesn’t seem feasible to find the ‘deleted’ dashboards using API;

on the other hand, you could still check out the DB table “deletedobject” using SQL View in the Maintenance App - execute the following query:

SELECT * FROM deletedobject
WHERE Klass = 'Dashboard';

@jason @Lorill_Crees How are you . It it possible to show deleted Dashboard in DHIS2

Regards

@Gassim thank you very much for this. This is my first to use SQL VIEW in Dhis2.I managed to create the script. So, how do i run the script and where to see the list of those dashboard.
Regards

@Gassim i got the answer

Good to know! Thanks! Here’s a screenshot:

Does this solve for the use case? If so please mark the post as solution :pray: Thanks!

1 Like

@Gassim Thank you very much. Yes this solve my first in initial problem while i have executed the query and received the result . I can see the ID of the Dashboard not name . Is possible to get the the actual dashboard name or how do i use that ID code to get the exact name of the dashboard. We have large number of deleted dashboard and we are tracing the people who deleted and name of those dashboard deleted

1 Like

Thanks!

For existing dashboards you can use (/api/dashboards/[Uid_here]) or run the query:

SELECT * FROM dashboard
WHERE Uid = 'eCpaaaaRUrf';

But since these dashboards have been deleted the query and API request will only work if you have backup, so if you have a backup database or instance then you can query for all the deleted dashboards after collecting the Uids:

SELECT * FROM dashboard
WHERE (Uid = 'eCaa1aRUrf' OR Uid = 'eCaa2aRUrf' OR ..... Uid = 'eCa600RUrf');

Hi there,

Is there a list of non-protected tables, which can be safely used for the View/Query purposes? How complex the SQL View could be?

Thank you
Regards,
Ulanbek

1 Like

The sharing settings of the queries in SQL View can be controlled. If it’s a SELECT statement then it surely can be executed and shared from the sharing settings it’s possible to select Metadata sharing settings and Data sharing settings for users and user groups. You actually need to change the Sharing Settings before executing the query.

You can view the list of available tables using:

SELECT *
FROM information_schema.tables
WHERE Table_schema = 'public';

Would like to add that it can also be used via API https://docs.dhis2.org/en/develop/using-the-api/dhis-core-version-master/visualizations.html#webapi_sql_views

It’s using Postgresql so it could be very complex. Probably need to test it! And let us know. :grin:

Thanks @Ulanbek !

@Gassim thank you very much while i cannot able to view the names of those deleted dashboard maybe because of the backup issues that you talked about. Also thank you for the highlighting DHIS2 SQL view …i think its an interesting tool to utilise. Where is the documentation of that DHIS2 SQL

1 Like

You’re welcome! It’s advised to always have back-up!

Sure!

Manage SQL Views

SQL Views API endpoint

Hope you make great use of it. Always feel free to post back to the community with your questions and experiences!

Thanks!

2 posts were split to a new topic: Using SQL View for integration