我是json和API的新手。
我正在处理的这个特定数据集(https://api.cdnjs.com/libraries)可以通过在?search=search_term
之后放置json
来搜索(例如:https://api.cdnjs.com/libraries?search=cloud)。但是当我使用另一个{ "error":"Using an unknown parameter" }
数据集(例如http://api.nobelprize.org/v1/prize.json)时,它会出错:
json
这是否与数据集的设置方式有关?方法或许?如何使其他bestFunction
可以像初始的那样搜索(所以我可以在我的搜索应用中使用它)?
答案 0 :(得分:0)
导航到所提供网址的main domain,您会发现该文档位于https://nobelprize.readme.io/v1.0
要优化结果,正如文档建议您应使用以下参数(搜索奖品时):year
,yearTo
,category
和numberOfLaureates
。< / p>
以下是精炼搜索的示例:
请求网址:http://api.nobelprize.org/v1/prize.json?category=physics&year=2017
响应:
{
"prizes": [{
"year": "2017",
"category": "physics",
"laureates": [{
"id": "941",
"firstname": "Rainer",
"surname": "Weiss",
"motivation": "\"for decisive contributions to the LIGO detector and the observation of gravitational waves\"",
"share": "2"
}, {
"id": "942",
"firstname": "Barry C.",
"surname": "Barish",
"motivation": "\"for decisive contributions to the LIGO detector and the observation of gravitational waves\"",
"share": "4"
}, {
"id": "943",
"firstname": "Kip S.",
"surname": "Thorne",
"motivation": "\"for decisive contributions to the LIGO detector and the observation of gravitational waves\"",
"share": "4"
}]
}]
}
如果不够清楚,我向API请求检索2017年物理类别中奖励的数据。