Run Url Encoded Query

Version 4.0.24.6 (latest)

Run an URL encoded query.

This requires the caller to encode the specifiers for the query into the URL query part using Looker-specific syntax as explained below.

Generally, you would want to use one of the methods that takes the parameters as json in the POST body for creating and/or running queries. This method exists for cases where one really needs to encode the parameters into the URL of a single 'GET' request. This matches the way that the Looker UI formats 'explore' URLs etc.

The parameters here are very similar to the json body formatting except that the filter syntax is tricky. Unfortunately, this format makes this method not currently callable via the 'Try it out!' button in this documentation page. But, this is callable when creating URLs manually or when using the Looker SDK.

Here is an example inline query URL:

https://looker.mycompany.com:19999/api/4.0/queries/models/thelook/views/inventory_items/run/json?fields=category.name,inventory_items.days_in_inventory_tier,products.count&f[category.name]=socks&sorts=products.count+desc+0&limit=500&query_timezone=America/Los_Angeles

When invoking this endpoint with the Ruby SDK, pass the query parameter parts as a hash. The hash to match the above would look like:

query_params =
{
  fields: "category.name,inventory_items.days_in_inventory_tier,products.count",
  :"f[category.name]" => "socks",
  sorts: "products.count desc 0",
  limit: "500",
  query_timezone: "America/Los_Angeles"
}
response = ruby_sdk.run_url_encoded_query('thelook','inventory_items','json', query_params)

Again, it is generally easier to use the variant of this method that passes the full query in the POST body. This method is available for cases where other alternatives won't fit the need.

Supported formats:

result_format Description
json Plain json
json_bi (RECOMMENDED) Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query. See JsonBi type for schema
json_detail (LEGACY) Row data plus metadata describing the fields, pivots, table calcs, and other aspects of the query
csv Comma separated values with a header
txt Tab separated values with a header
html Simple html
md Simple markdown
xlsx MS Excel spreadsheet
sql Returns the generated SQL rather than running the query
png A PNG image of the visualization of the query
jpg A JPG image of the visualization of the query

Request

GET /queries/models/{model_name}/views/{view_name}/run/{result_format}
Datatype
Description
Request
HTTP Request
path
HTTP Path
Expand HTTP Path definition...
model_name
string
Model name
view_name
string
View name
result_format
string
Format of result

Response

200: Query

Datatype
Description
(string)
string

400: Bad Request

Datatype
Description
(object)
message
string
Error details
documentation_url
string
Documentation link

404: Not Found

Datatype
Description
(object)
message
string
Error details
documentation_url
string
Documentation link

422: Validation Error

Datatype
Description
(object)
message
string
Error details
Expand ValidationErrorDetail definition...
field
string
Field with error
code
string
Error code
message
string
Error info message
documentation_url
string
Documentation link
documentation_url
string
Documentation link

429: Too Many Requests

Datatype
Description
(object)
message
string
Error details
documentation_url
string
Documentation link

Examples

C#

https://github.com/looker-open-source/sdk-codegen/blob/main/csharp/sdk/4.0/methods.cs

Go

https://github.com/looker-open-source/sdk-codegen/blob/main/go/sdk/v4/methods.go

Kotlin

https://github.com/looker-open-source/sdk-codegen/blob/main/kotlin/src/main/com/looker/sdk/4.0/methods.kt
https://github.com/looker-open-source/sdk-codegen/blob/main/kotlin/src/main/com/looker/sdk/4.0/streams.kt

TypeScript

https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk/src/4.0/funcs.ts
https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk/src/4.0/methods.ts
https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk/src/4.0/methodsInterface.ts
https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk/src/4.0/streams.ts
https://github.com/looker-open-source/sdk-codegen/blob/main/packages/sdk-codegen/src/python.gen.spec.ts

Python

https://github.com/looker-open-source/sdk-codegen/blob/main/python/looker_sdk/sdk/api40/methods.py

Swift

https://github.com/looker-open-source/sdk-codegen/blob/main/swift/looker/sdk/methods.swift
https://github.com/looker-open-source/sdk-codegen/blob/main/swift/looker/sdk/streams.swift