Getting query definition from the API does not return "query_fields" under "vis_config" all the time via API

I would like to get query definitions from the looker API. I also want to get “measure” and “dimension” definitions in the query.

I’m hitting “GET/api/3.1/queries/{query_id}” endpoint.

For some of the queries it returns “measures” and “dimensions” under “vis_config.query_fields”, but for some of them it doesn’t return them at all. I couldn’t understand why it doesn’t return for some of them.

How can I find a workaround for this?

2 0 115