Error: 400 Bad Request on API query syntax

I am trying to get the KoboToolbox submission for a specific week; where _submission_time > ‘2024-01-29T00:00:01’ AND _submission_time < ‘2024-02-05T23:59:01’

Here is the REST command sent to the KoboToolbox API server:
String query = {“$and”:[{“_submission_time”:{“$gt”:“2024-01-29T00:00:01”}},{“_submission_time”:{“$lt”:“2024-02-05T23:59:01”}]};

String endpoint = ‘’ + query;
Adding the EncodingUtil.urlEncode(query, ‘UTF-8’).

The KoboToolbox responded with : “Error: 400 Bad Request”

Please, do anyone know why I am getting an error with this query syntax?

@carlfost7, this post discussed previously should help you solve your issue: