The Looker API Explorer is an extension — a web application built using Looker components — that is developed using the Looker extension framework and deployed through the Looker Marketplace.
The API Explorer provides the following assets:
- Documentation for all Looker API methods and types
- Method and type declarations in all supported SDK languages
- Links to example SDK functions that use API methods
- Links to API Explorer pages for referenced methods and types
- A Run It function that lets you execute API calls directly and provides the code for the API calls, API responses, and SDK functions
- A comparison tool that shows the differences in Looker API versions
There is no need for the user to log in for the extension version of API Explorer, because API Explorer uses the active user’s account for API requests. This ensures that the user can only perform the API calls to which they are entitled while also eliminating the need for them to provide API credentials.
Looker’s sudo as another user feature can also be used to make API requests as a different user to help diagnose access issues.
Installing the API Explorer
The API Explorer requires Looker 21.4 or later.
The API Explorer is available on the Looker Marketplace.
Before installing the API Explorer from the Marketplace, a Looker admin must enable the Extension Framework Labs feature.
Installing applications — such as the API Explorer extension — from the Marketplace requires that you have the
deploy permissions. Once the API Explorer has been installed, any user can access it and will have access to API calls based on their permissions.
See the Using the Looker Marketplace documentation page for instructions on installing an extension from the Looker Marketplace. You can ensure that you always have the most updated version of the API Explorer by going to the Looker Marketplace, clicking Manage, and clicking the Update button next to the extension.
Starting the API Explorer
Once the API Explorer is installed, you can navigate to it a couple of ways:
- From the list of installed applications and extensions in the Browse menu
From the Applications & Tools page, accessible from the Browse menu and the left sidebar
Navigating in the API Explorer
From the API Explorer home page you can perform the following tasks:
Use the SDK language selector drop-down to choose the programming language in which the API Explorer will display API method and type declarations and code results. The selector defaults to Python on initial load. If you choose All from the language selector, the API Explorer displays a tabbed view for each supported language.
Use the version drop-down to choose a version of the API:
- 3.1 - current
- 4.0 - experimental
Click the triangle icon in the top right to open the API Explorer comparison page.
Enter a search term in the Search field to limit the Methods and Types listed to only those that include text that matches your search term:
When you select a method or type returned by the search, the search term will be highlighted in the method or type summary.
Select the Methods tab to display API method categories. You can expand or contract a method category to view the individual methods in the category.
Select the Types tab to display API types. Types are not categorized and are listed in alphabetical order.
Click the three-bar icon to hide or show the API Explorer navigation panel.
Viewing API method and type documentation
When you select a method category in the Method tab, the method category expands and shows you all the methods in that category:
In the main panel, all the methods in that category are shown. You can choose to display all the methods in the category, or you click on the tab for a particular method type to filter the list to just that method type.
To view the documentation for a specific method, either choose the method name in the navigation panel, or click on the method in the main panel.
Once you have selected a specific method, the API Explorer displays the documentation for that method:
When you select a type from the Type tab, the documentation for that type displays in the main panel:
Method and type declarations
API Explorer renders the SDK method and type declarations in the SDK language that is chosen in the SDK language selector drop-down. If the SDK language selector is set to All, the method and type declarations are displayed in all supported SDK languages, separated by tabs:
sdk-codegen repository has a folder that contains Looker SDK examples. If the
sdk-codegen repository has examples for a method, the method’s API Explorer page will display an SDK Examples section with links to the examples.
If a specific SDK language is selected, examples for that language are listed first. For example, the following SDK Examples table shows Swift as the selected language:
There may also be Ruby and Java examples displayed, although these are not SDK languages.
The References section for each method and type includes links to the API Explorer pages for each method or type that is referenced by the original method or type:
Using Run It to request and display API calls
The API Explorer includes a Run It button that opens a panel from which you can request API calls and display the responses in a variety of supported formats:
When you click the Run It button, the API Explorer displays a Request tab, where you can provide the inputs to the API method:
Enter the desired input, and click Run to execute the API call.
Whenever the API method can change data (for any REST call that is a
UPDATE, or a
DELETE), the data change confirmation checkbox appears and must be checked before the request can be run.
When the request is run, the Response tab shows the results:
In addition, the Code tab shows the SDK call syntax for the SDK that is chosen in the language selector drop-down. If the SDK language selector is set to All, the SDK call syntax is displayed in all supported SDK languages, separated by tabs:
Response display types
API Explorer responses include a MIME type that is used to determine how to display the results.
CSV and other tabular data
For CSV and JSON, a simple “shape” test is performed to determine whether the data “looks like a table.” If the payload data does look like a table, then the default display for the response is a data grid:
The Raw tab can be used to display the untransformed data:
JSON payloads may be “tabular,” in which case they will be displayed in a grid. The column headers for the LookML query are different for JSON format than they are for CSV:
Complex JSON payloads omit the grid display and display only the raw JSON:
PNG and JPEG
Below is an example of the same query above, rendered in PNG format. JPEG is handled similarly:
Some Looker endpoints return SVG, which is also directly supported. Below is an example of the
content_thumbnail endpoint in SVG format:
HTML source code is highlighted in the Response tab:
SQL and other responses that are MIME typed as plain text are displayed like this:
Comparing API versions
The API Explorer includes a page that lets you compare different versions of the Looker API and see what has changed between versions. Click the triangle at the top right of the page to open the API Explorer comparison page.
Select the base version of the API and the version of the API you want to compare to the base version.
Select the API options that you want to include in the comparison to filter the methods to only those that have differences in the options you select. The options are:
- Missing — Shows all the methods that exist in one version of the API and that are missing in the other.
- Status — Shows all methods where the method status has changed. For example, a method where the status has changed from
- Parameters — Shows all methods where one or more of the method parameters has changed.
- Type — Shows types that have new, removed, or changed properties.
- Body — Shows changes to body parameters.
- Response — Shows all methods where there has been a change in the method response.
The comparison page shows you the number of methods where there is a difference and lists the methods where there is a difference.
Click on a method to expand it, and the comparison page displays a diff that shows how the method has changed between versions.