简体   繁体   English

使用REST调用Google自定义搜索API

[英]using REST to invoke Google Custom Search API

I need to use a Google Custom Search to get the count of a word from Google. 我需要使用Google自定义搜索来获取Google的字数。 I have created a Google Custom Search Engine and I followed the steps described in this guide: 我已经创建了一个Google自定义搜索引擎,并按照了本指南中所述的步骤操作:

https://developers.google.com/custom-search/v1/using_rest https://developers.google.com/custom-search/v1/using_rest

How can I get the count from the response data? 如何从响应数据中获取计数? Secondly, how can I convert this response into a JSONObject using java? 其次,如何使用Java将响应转换为JSONObject?

Also is the Google API free? Google API也免费吗?

From the link you provided ( https://developers.google.com/custom-search/v1/using_rest ) 通过您提供的链接( https://developers.google.com/custom-search/v1/using_rest

Important: The JSON/Atom Custom Search API requires the use of an API key, which you can get from the Google APIs console. 重要提示:JSON / Atom自定义搜索API需要使用API​​密钥,您可以从Google API控制台获取。 The API provides 100 search queries per day for free . 该API每天免费提供100个搜索查询 If you need more, you may sign up for billing in the console. 如果您需要更多,可以在控制台中注册计费。

If the custom search engines can serve in JSON format you can set a request header of Accept: application/json 如果自定义搜索引擎可以JSON格式提供服务,则可以将请求的标头设置为Accept:application / json

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM