View the original community article here
Last tested: Feb 17, 2020
Recorded Use Case:
User running Looker V6.24.30 was trying to get pull some details about a specific dashboard via `run_inline_query` API call in their program but ran into errors in one of the cases. Receiving "Error: Must query at least one dimension or measure" as a response.
API Call:
Call Type: SDK
Endpoint: run_inline_query(result_format, body)
More: Docs
Sample Logic expected in development IDE of the client (Outside of Looker e.g. Python, Ruby, NodeJS...):
# instantiate Look API client
queryAPI = looker.QueryApi(client)
body = {
"model":"thelook",
"view":"inventory_items",
"fields":["category.name","inventory_items.days_in_inventory_tier","products.count"],
"filters":{"category.name":"socks"},
"sorts":["products.count desc 0"],
"limit":"500",
"query_timezone":"America/Los_Angeles"
}
resp = queryAPI.run_inline_query("json",body)
The EXPERIENCE
Request Body:
body = {
"model": "dashboard_login_model,
"view": "view_name_1",
"fields": [
"view_name_2.user_count_red",
"view_name_2.user_count_yellow",
"view_name_2.user_count_green",
"view_name_2.score_range",
],
"filters": {
"l_content_usage.event_date": "3 months",
"l_content_usage.role_filter": "",
"l_content_usage.school": "",
},
"sorts": [
""
],
"limit": "-1"
}
Received an error similar to the one shown below:
Likely reason: Fields being called don't exist in production, switch API workspace to development
Resolution:
By default, API calls run in production mode. That means Looker will load all projects and LookML models from the production directory on the Looker instance.. You can change the workspace of the API session to "dev" in order to run queries against models residing in the dev mode subdirectory of the user calling the API.
How do I run API calls in dev mode?
Once the Workspace has been switched to Development, "dev", the API user can find the fields not previous found in production.
This content is subject to limited support.