Search code examples
google-apigoogle-pluspermalinks

Construct Google+ Post Permalink Given UserID and ActivityID


I am using the Google+ API V1: https://developers.google.com/+/api/

I am trying to programatically build a permalink to a given G+ post given a userId and an activityId.

I can make the following GET request to the API URL:
https://www.googleapis.com/plus/v1/activities/z12rwbngzpbzi1i2q23qizvavtaiixfy104?key={YOUR_API_KEY}
where z12rwbngzpbzi1i2q23qizvavtaiixfy104 is the activityId.

And I get back the following response:

{
 "kind": "plus#activity",
 "etag": "\"RqKWnRU4WW46-6W3rWhLR9iFZQM/NFwidT-LJOR8oitQXt0iVc0TQwk\"",
 "title": "Best. Nade. Ever.",
 "published": "2014-05-15T01:13:22.496Z",
 "updated": "2014-05-15T01:13:22.496Z",
 "id": "z12rwbngzpbzi1i2q23qizvavtaiixfy104",
 "url": "https://plus.google.com/116428676193009789012/posts/FTcMCiju5ux",
 "actor": {
  ...
 },
 "verb": "post",
 "object": {
  ...
 },
 "provider": {
  ...
 },
 "access": {
  ...
 }
}

You see the response JSON includes an id field which is the activityId as well as a url field which I am trying to construct without needing to make an API call. The URL is in the form https://plus.google.com/{USER_ID}/posts/{UNKNOWN_ID} so "116428676193009789012" is my G+ userId.

I have tried to use different URL formats to see if any combination will work, even if it just redirects me to the actual URL. All of the following formats result in a 404 response:

  • https://plus.google.com/{USER_ID}/{ACTIVITY_ID}
  • https://plus.google.com/{USER_ID}/posts/{ACTIVITY_ID}
  • https://plus.google.com/{ACTIVITY_ID}
  • https://plus.google.com/u/0/{USER_ID}/{ACTIVITY_ID}
  • https://plus.google.com/u/0/{USER_ID}/posts/{ACTIVITY_ID}

How can I construct a valid Google Plus Post URL (permalink) given a userId & activityId?
Is it even possible?


Solution

  • You can use activityId to link to the mobile interface but it will look terrible on desktops. For desktops there is no choice but to query the API.

    https://plus.google.com/app/basic/stream/z12rwbngzpbzi1i2q23qizvavtaiixfy104