0

When I'm making what seems like a working query:

https://api.fda.gov/food/enforcement.json?api_key=123&search=report_date:[2021111+TO+20211112]

I get an error:

[token_mgr_error] token_mgr_error: Lexical error at line 1, column 32. Encountered: "]" (93), after :

That same query works fine when done in browser but it's failing in my API tool. Any ideas?

Secondly, Is there another way to do a relative date or date range in the API if brackets simply can't work for me?

1 Answer 1

0

Try to urlencode() or a similar function in your server-side language to encode the special characters in your API URL.

1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Jan 18, 2022 at 15:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.