Curl with filter returns '400 Bad Request'

When i try to download data in json with parameter filter:

curl --compressed -g -X GET ‘https://kc.kobotoolbox.org/api/v1/data/902546?query={"_submission_time":{"$gt": “2022-01-17T17:14:45:30”}}’

I have the error 400 Bad Request

But this same request work last week. Are the a update on koboToolBox plateforme?

Thanks for reply

I have a problem downloading the JSON database with CURL.
The same script curl market several days ago, but since yesterday it shows me this error in the downloaded file:

<html>
<head><title>400 Bad Request</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx/1.21.6</center>
</body>
</html>

Command:
curl -X GET ‘https://kc.kobotoolbox.org/api/v1/data/902546?query={"_submission_time":{"$gt": “2022-01-17T17:14:45:30”}}’ -H …

Thanks for your helps!

@momou28, have you checked your data to see if it’s public?

@Kal_Lam , I use my administrator account which hosts the form and I am the owner. When I remove the query filter, there is no problem. But with the filter it generates the error. Last week no problem.
Where do I check if the data is public?
For information, I use the administrator account in the command for downloading.

Thanks a lot KAL

This post discussed previously should help you make your data public:

Hi @momou28, it looks like the issue is with the type of quotes surrouding the date in your query. If I replace “2022-01-17T17:14:45:30” with "2022-01-17T17:14:45:30" then it works :+1:

1 Like

Thank a lot

1 Like

There may have been some updates on the KoboToolbox platform, but this looks like an issue with the syntax of your query. It looks like you need to use double quotes instead of single quotes around the date in your query. It’s also possible that there may be an issue with the URL escape characters in the query. You can try using the URL-encoded version of the double quotes instead. Here is the article on the status code 400: causes and fixes. I hope that helps! If you cannot find a solution yourself, then you might want to consult specialists from this company.