如何从谷歌获取附件+ api活动搜索?

发布于 2024-12-10 13:21:50 字数 1040 浏览 0 评论 0原文

https://developers.google.com/+/api/latest/ events#object.attachmentsactivities search响应中会有附件,但是如何调用它呢?

此处:http://code.google .com/apis/explorer/#_s=plus&_v=v1&_m=activities.search 即使我选择了所有 fields 部分,也没有附件。

最终调用url在这里

https://www.googleapis.com/plus/ v1/activities?maxResults=20&orderBy=最近 &query=关键字&fields=id%2Citems(access%2Cactor%2Caddress%2Cannotation%2CcrosspostSource%2Cgeocode%2Cid%2Ckind%2CplaceId%2CplaceName%2Cplaceh old%2Cpublished%2Cradius%2Ctitle%2Cupdated%2Curl%2Cverb)%2Ckind%2CnextLink%2CnextPageToken%2CselfLink%2Ctitle%2Cupdated&pp=1&key=APIKEY

那么,如何获取附件呢?

In https://developers.google.com/+/api/latest/activities#object.attachments, there would have attachments in activities search response, but how to call it?

In here: http://code.google.com/apis/explorer/#_s=plus&_v=v1&_m=activities.search even I select all the fields section, there have no attachments.

The final call url here

https://www.googleapis.com/plus/v1/activities?maxResults=20&orderBy=recent
&query=keyword&fields=id%2Citems(access%2Cactor%2Caddress%2Cannotation%2CcrosspostSource%2Cgeocode%2Cid%2Ckind%2CplaceId%2CplaceName%2Cplaceholder%2Cpublished%2Cradius%2Ctitle%2Cupdated%2Curl%2Cverb)%2Ckind%2CnextLink%2CnextPageToken%2CselfLink%2Ctitle%2Cupdated&pp=1&key=APIKEY

So, how to get attachments?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ゞ记忆︶ㄣ 2024-12-17 13:21:50

附件将是嵌套在对象属性下的 json 数组。
这是一个示例请求:
https://www.googleapis .com/plus/v1/activities?query=google&sortBy=recent&maxResults=20&key=GOOGLE_API_KEY

查看从您的浏览器中获取它,并在响应中查找“附件”。

对于包含附件的活动,您应该看到类似这样的内容:

"attachments": [
 {
  "objectType": "article",
  "displayName": "Google taking a...",
  "content": "insert content..."
 },
 {
  "objectType": "photo",
  "image": {
   "url": "http://images0-focus-opensocial.g...",
   "type": "image/jpeg"
  },
  "fullImage": {
   "url": "http://thenextweb.com/wp-content/...",
   "type": "image/jpeg",
   "height": 199,
   "width": 300
  }
 }
]

以下是如何使用 events.search API 并提取图像附件的示例:
https://gist.github.com/1296676

The attachments will be and a json array nested under the object property.
Here's a sample request:
https://www.googleapis.com/plus/v1/activities?query=google&sortBy=recent&maxResults=20&key=GOOGLE_API_KEY

View it from your browser, and look for "attachments" in the response.

You should see something like this for activities that contain attachments:

"attachments": [
 {
  "objectType": "article",
  "displayName": "Google taking a...",
  "content": "insert content..."
 },
 {
  "objectType": "photo",
  "image": {
   "url": "http://images0-focus-opensocial.g...",
   "type": "image/jpeg"
  },
  "fullImage": {
   "url": "http://thenextweb.com/wp-content/...",
   "type": "image/jpeg",
   "height": 199,
   "width": 300
  }
 }
]

Here's an example of how you can use the activities.search API and extract image attachments:
https://gist.github.com/1296676

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文