1
votes

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?

1

1 Answers

2
votes

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