Auth0 Home Blog Docs

400 | Bad Request - Invalid query: Syntax Error

Hi,
I am trying to get the users, which are updated after a specific date,
https:///api/v2/users?per_page=50&page=0&include_totals=true&sort=email:1&include_fields=true&q=updated_at:>2019-06-30

But, when I call this URL via curl, I get the following error.
Auth0 response {“statusCode”:400,“error”:“Bad Request”,“message”:"Invalid query: Syntax Error, cannot parse updated_at:>2019-06-30: "}

Can anyone please guide me what is wrong with my query?
Thanks

Hey there @umar.zulfiqar!

Let me check the syntax for it and tell you how to solve it!

Thanks ,I am using Auth0 V2 API.

Hey so in lucene query syntax (which is utilised by the API) date ranges work like: a_date:[2019-06-01 TO 2019-06-30] so you may use something like:

http://auth0.com/api/v2/users?q=updated_at%3A%20[2019-06-01%20TO%202019-07-03]

When I tried with the following URL.
https://.auth0.com/api/v2/users?per_page=50&page=0&include_totals=true&sort=email:1&include_fields=true&q=updated_at:[2019-06-30 TO 2019-07-02]

I got the following response.

403 Forbidden

403 Forbidden

I think the approach you have shared is applicable with V3 but not with V2.

I found that the way you suggested is working fine when i check with Postman, but not with Curl call.

Hmmm gotchya! Let me check something else! I’ll get back to you soon!

1 Like

Have you tried exactly with the percent symbol as I’ve written above?

@konrad.sopala Thanks man! it worked.

Glad I was able to help!

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.