USDA / USDA-APIs

Do you have feedback, ideas, or questions for USDA APIs? Use this repository's Issue Tracker to join the discussion.
www.usda.gov/developer
107 stars 16 forks source link

Colon character breaks Food Search API #81

Open seanharr11 opened 4 years ago

seanharr11 commented 4 years ago

Searching for "Ezekiel 4:9" in the Food Search API throws a 500. I am seeing an "All Shards Failed" message, but the servers do not actually crash (they are still up).

Let me know how I can help.

littlebunch commented 4 years ago

@seanharr11 I've sent a defect report to the developers for this. The same request works when issued as a POST: curl -H "Content-type:application/json" -XPOST https://api.nal.usda.gov/fdc/v1/search?api_key="DEMO_KEY" -d '{"generalSearchInput":"Ezekiel 4:9"}' as a potential work around.

seanharr11 commented 4 years ago

Cool - thanks Gary. Happy to verify fix when this is up!

littlebunch commented 4 years ago

@seanharr11 If you don't mind could you post the XHR call you're making for this as it seems to work Ok with a curl call:

curl -H "Content-type:application/json" -XGET https://api.nal.usda.gov/fdc/v1/search?api_key=DEMO_KEY\&generalSearchInput=Ezekiel%204:9

I did have to encode the string.