Creating views from queries via API

LabKey Support Forum (Inactive)
Creating views from queries via API Jon (LabKey DevOps)  2019-11-29 17:02
Status: Closed
 
Hi Jonathan,

You could try to leverage the LABKEY.Report API endpoint to try and insert in new Query Reports into the Data Views page.

https://www.labkey.org/download/clientapi_docs/javascript-api/symbols/LABKEY.Report.html

However, it might be easier for you to just create a single wiki page that has some basic HTML with links that point to your external schema and tables.

If you look at your grid view for one of those tables on that external schema, you'll see the format of the URL containing the schemaName and queryName:

https://www.mylabkeyserver.com/MyProject/query-executeQuery.view?schemaName=MyExternalSchema&query.queryName=MyTable

If you have a list of those tables, you could build an HTML wiki with those tables as links and then use that wiki as a web part for users to access.

If you want to try to build this a little bit more programmatically, it is also possible to get a list of those tables from the Query API endpoint, which you can then extract those table/query names and build those same HTML links for your wiki.

https://www.labkey.org/download/clientapi_docs/javascript-api/symbols/LABKEY.Query.html#.getQueries

Regards,

Jon