您收到此错误:
{
"errors": {
"error": [
{
"status": 400,
"parameter": "ds",
"message": "Unknown ds (Data Source) -- can be Branded Food Products or Standard Reference."
}
]
}
}
它提示ds 参数应该是Branded Food Products 或Standard Reference,所以再试一次https://api.nal.usda.gov/ndb/search/?format=json&q=butter&sort=n&max=25&offset=0&api_key=DEMO_KEY&ds=Standard%20Reference ...瞧!
{
"list": {
"q": "butter",
"sr": "1",
"ds": "Standard Reference",
"start": 0,
"end": 25,
"total": 104,
"group": "",
"sort": "n",
"item": [
{
"offset": 0,
"group": "Baked Products",
"name": "Archway Home Style Cookies, Peanut Butter",
"ndbno": "18541",
"ds": "SR",
"manu": "Archway Cookies"
},
{
"offset": 1,
"group": "Dairy and Egg Products",
"name": "Butter, Clarified butter (ghee)",
"ndbno": "01323",
"ds": "SR",
"manu": "none"
},
...