简体   繁体   English

如何使用ruby客户端访问包含siteURL的Google API方法?

[英]How do I access Google API methods that include siteURL with the ruby client?

I'm trying to access the Google Webmaster Tools API with the ruby client: 我正在尝试使用ruby客户端访问Google Webmaster Tools API:

webmaster_tools_api = client.discovered_api('webmasters', 'v3') 

                  result = client.execute(
                    :api_method  => webmaster_tools_api.sites.example.com.urlCrawlErrorsCounts.query,

                   )

The API method I am trying to access uses the siteurl in the method name. 我尝试访问的API方法使用方法名称中的siteurl。 This won't work because the syntax conflicts. 由于语法冲突,因此无法使用。

Is there a way to access API method names that include URLs? 有没有办法访问包含URL的API方法名称?

results = client.execute(
  api_method: webmaster_tools_api.urlcrawlerrorscounts.query,
  parameters: { 'siteUrl' => 'example.com' }
)

(Google's API docs are terrible so it's not surprising you couldn't find this.) (Google的API文档非常糟糕,因此找不到它也就不足为奇了。)

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

相关问题 如何使用Drive API的Ruby客户端将文本写入Google文档? - How Do I Write Text to a Google Doc using Drive API's Ruby Client? 将 React 用作前端时,如何在 Ruby API 中访问用户的 Google 日历? - How do I get access User's Google Calendar in my Ruby API when using it with React as a Frontend? Google API Ruby客户端执行vs服务方法 - Google API Ruby Client execute vs Service methods 我如何通过google-api-ruby-client 0.9授权OAuth 2.0使用Google API服务? - How can I OAuth 2.0 authorise a Google API service with google-api-ruby-client 0.9? Ruby:如何将模块中的方法包含到ActiveModel :: Serializer的子类中 - Ruby: How do I include methods from a Module into a subclass of ActiveModel::Serializer 如何授权 google-api-ruby-client? - How to authorize the google-api-ruby-client? Ruby on Rails3:如何在路由中包括非标准方法? - Ruby on Rails3: how do I include non-standard methods in the routes? 如何在Ruby中保存Google API凭据? - How do I save Google API credentials in Ruby? Ruby on Rails api json响应方法,包括 - Ruby on Rails api json response methods and include 如何在ruby脚本中访问Rails方法? - How can I access rails methods in a ruby script?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM