Routing
In this article, we will consider in which cases the Datagrok platform retains the state in which it was before refreshing the browser page. Routing allows you to quickly share something by simply copying a URL and sending it to another person to whom you want to show a particular view, project, application, etc. We will find out which actions Datagrok can perform under the hood as the user goes to a specific URL (for example, executing a query with given parameters).
Entity browsers
Entity browsers are special platform views that display a set of certain entities to the user. Each such browser is available by a URL.
The platform has browsers for the following entities:
Projects
A project uploaded to the server can be opened via a direct URL. If a project has more than one table
view, you can pass the name of a specific view to the URL so that you can see it after opening. Links to projects are
generated according to the following
rule: https://public.datagrok.ai/p/{project.namespace}.{project.name}/{tableView.name}
Example: https://public.datagrok.ai/p/demo.pic50/desc_canvas_aug30
The above link will open the https://public.datagrok.ai/p/demo.pic50/desc_canvas_aug30
view from the pic50
project,
which belongs to the demo
namespace. Notice that it is not necessary to include a table view in the project URL. If
not specified, the first view from the project will open.
Files
A file share for which the user has access is available by the link. You should specify the file share name and the namespace in which it exists in the URL, for example, https://public.datagrok.ai/files/demo.testjobs.files.demofiles .
The above link will open a view for the demofiles
file share. Since the platform supports nesting of namespaces, there
can be more than one namespace in a URL. Our example has several namespaces separated by periods: demo
, testjobs
,
and files
. This means that every next namespace can be reached from the previous one (in practice, this is possible
when one project is nested within another).
Here is an example of a link to a file share with one namespace: https://public.datagrok.ai/files/skalkin.datagrokdata . In this case, the namespace is a personal project of the user who created this file share.
File share URLs support directory nesting. With its help, you can easily get to subdirectories of any nesting depth. For
example: https://public.datagrok.ai/files/demo.testjobs.files.demofiles/chem/zbb
. After following the link above, you will see the zbb
folder, which exists inside the chem
folder in the demofiles
file share.
Queries
Datagrok supports execution of saved queries via URL. For example, after following the
link https://public.datagrok.ai/q/Demo.Northwind.Products
, the query Products
will be executed and we will see the table that has just been created as a query result.
The link to a data query, in addition to its name, must also contain the corresponding data connection name and the namespace (or several nested namespaces).
Parameterized queries can be executed as well. In this case, query parameters are passed directly in the URL. For example:
https://public.datagrok.ai/q/Demo.CoffeeCompany.StoresInState?state=NY
Opening the above link triggers the StoresInState
query execution, with the state
parameter value equal to NY
.
Once completed, it will output the resulting table.
See also: