Issue with filter_by in Databricks SQL Query History API (/api/2.0/sql/history/queries)

lukamu
New Contributor II

Hi everyone,

I'm trying to use the filter_by parameter in a GET request to /api/2.0/sql/history/queries, but I keep getting a 400 Bad Request error. When I use max_results, it works fine, but adding filter_by causes the request to fail.

Example value for filter_by in the request:

 

{
   "statuses":["FINISHED","CANCELED"],
   "query_start_time_range":{
       "start_time_ms" : 1640995200000, 
       "end_time_ms" : 1641081599000
   }
}

 

Response

 

{
    "error_code": "MALFORMED_REQUEST",
    "message": "Could not parse request object: Expected 'START_OBJECT' not 'VALUE_STRING'\n at [Source: (ByteArrayInputStream); line: 1, column: 15]\n at [Source: java.io.ByteArrayInputStream@28488ac8; line: 1, column: 15]"
}

 

I've tried several variations, but I keep getting the same error. Unfortunately, the documentation does not include an example of how to format filter_by correctly in the query string.

Has anyone successfully used filter_by in this API? If so, could you share a working example?

Thanks!