I am trying to search some of the "free text" fields that have values with commas, apostrophes, etc. With the encoding I have tried all combinations of quotes, parenthesis, etc. however it always results in an error.

I have tried URL encoding and other approaches that seem RFC 3986 compliant, however I always seem to get this error:

{ error: { code: "BAD_REQUEST", message: "" } }

Here's an example of a search: http://api.fda.gov/food/enforcement.json?limit=1&search=product_description:(Today%27s+Harvest)

[The above should search for Today's Harvest]

Is this type of search possible/supported?

2 Answers 2


Unfortunately, we don't allow embedded single-quotes in search strings. You will have to get creative. The following query appears to get find what you are looking for: http://api.fda.gov/food/enforcement.json?limit=10&search=product_description:%22Harvest(TM)%22

Good luck.

  • 1
    Thanks for the definitive response. However you might want to look to support this in the future as this seems (naive?) like a fairly straight-forward feature.
    – philarmour
    Commented Jun 24, 2015 at 1:57

We concur. Query errors should return a real value, not just an error. For instance, providing an error when a count = 0 is not useful to anyone. Not supporting embedded single-quotes in search strings is also short-sighted. Either adjust the data to remove apostrophes or provide a more robust error response.

Your Answer

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

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