纽约时报API通过命令行

时间:2015-02-20 22:45:21

标签: api command-line text-analysis

使用命令行进入纽约时报API并遇到问题。当我运行http://api.nytimes.com/svc/search/v2/articlesearch.json?[q=obama]&api-key=(my密钥时,我得到'http' is not recognized as an internal or external command, operable program, or batch file'

任何帮助都将不胜感激。

1 个答案:

答案 0 :(得分:2)

简单地键入URL在Linux上不起作用。您必须使用curl。用于从curl的GET请求中检索JSON:

curl -i -H "Accept: application/json" -H "Content-Type: application/json" -X GET http://api.nytimes.com/svc/search/v2/articlesearch.json?q=obama&api-key=KEY

致以最诚挚的问候,