Google Plus Rest API

A rest API flow that wraps the Google Plus API.

This flow makes use of the Google Web Nodes (https://github.com/node-red/node-red-web-nodes/tree/master/google)

Prerequisites

  • First, you will need to install the Google Web Nodes.

      npm install node-red-node-google
    
  • The Google Plus API requires a Google Developer API key. You will need to create a project with Google in order to obtain one. You will need to follow the instructions within the editor to set the Redirect URI for the project. (https://code.google.com/apis/console/)

  • This flow also contains additional swagger documentation. This is to be used with the Node Red Swagger Plugin (https://github.com/node-red/node-red-node-swagger)

      npm install node-red-node-swagger
    

Usage

The flow will create an HTTP endpoint for each of the Google Plus API requests. Each individual endpoint will direct the user's input to a different Google Plus API request. You can make changes to the Google Directions node's configuration if you would like to include any information ahead of time. You will need to use the config node to link a Google Plus account. Alternatively, the user can pass in their own access token via the msg object if you want to allow multiple users to use the flow. All properties taken by the Google Plus node can be passed as msg level parameters. The Google Plus node is heavily documented, and details about possible parameters can be acquired via the info tab. All errors that occur will be relayed back to the user via the catch node.

[{"id":"a7fa0569.e982c8","type":"swagger-doc","summary":"Google Plus Comments List Request","description":"List all of the comments for an activity.","tags":"GooglePlus","consumes":"application/json","produces":"application/json","parameters":[{"name":"accessToken","in":"query","description":"Google provided authorization token.","required":true,"type":"string"},{"name":"activityId","in":"query","description":"\t  The ID of the activity to get comments for.","required":true,"type":"string"},{"name":"maxResults","in":"query","description":"The maximum number of people to include in the response, which is used for paging. For any response, the actual number returned might be less than the specified maxResults.","required":false,"type":"integer"},{"name":"pageToken","in":"query","description":"The continuation token, which is used to page through large result sets. To get the next page of results, set this parameter to the value of \"nextPageToken\" from the previous response.","required":false,"type":"string"},{"name":"sortOrder","in":"query","description":"The order in which to sort the list of comments. Acceptable values are: \"ascending\": Sort oldest comments first. (default); \"descending\": Sort newest comments first.","required":false,"type":"string"}],"responses":{"200":{"description":"The comments returned by the request","schema":{"properties":{"nextPageToken":{"type":"string"},"results":{"type":"array","items":{"type":"string","format":""}},"status":{"type":"string"}}}},"400":{"description":"Your request was malformed, either by missing or incorrect parameters","schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"},"status":{"type":"string"}}}},"429":{"description":"You have used the daily allotment of requests for the provided API Key","schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"},"status":{"type":"string"}}}},"500":{"description":"An unknown error occurred. Please try your request again.","schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"},"status":{"type":"string"}}}}},"deprecated":false},{"id":"f95e9afc.86bec","type":"swagger-doc","summary":"Google Plus Comments Id Request","description":"Get a comment.","tags":"GooglePlus","consumes":"application/json","produces":"application/json","parameters":[{"name":"accessToken","in":"query","description":"Google provided authorization token.","required":true,"type":"string"},{"name":"commentId","in":"query","description":"The ID of the comment to get.","required":true,"type":"string"}],"responses":{"200":{"description":"The comment requested","schema":{"properties":{"actor":{"type":"string"},"id":{"type":"string"},"inReplyTo":{"type":"boolean"},"object":{"type":"string"},"plusoners":{"type":"integer"},"published":{"type":"string"},"status":{"type":"string"},"updated":{"type":"string"},"verb":{"type":"string"}}}},"400":{"description":"Your request was malformed, either by missing or incorrect parameters","schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"},"status":{"type":"string"}}}},"429":{"description":"You have used the daily allotment of requests for the provided API Key","schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"},"status":{"type":"string"}}}},"500":{"description":"An unknown error occurred. Please try your request again.","schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"},"status":{"type":"string"}}}}},"deprecated":false},{"id":"b231666a.960e98","type":"swagger-doc","summary":"Google Plus Activities List Request","description":"List all of the activities in the specified collection for a particular user.","tags":"GooglePlus","consumes":"application/json","produces":"application/json","parameters":[{"name":"accessToken","in":"query","description":"Google provided authorization token.","required":true,"type":"string"},{"name":"collection","in":"query","description":"The collection of activities to list. Acceptable values are: \"public\": All public activities created by the specified user.","required":true,"type":"string"},{"name":"userId","in":"query","description":"Get the collection of people for the person identified. The special value \"me\" can be used to indicate the authenticated user.","required":true,"type":"string"},{"name":"maxResults","in":"query","description":"The maximum number of people to include in the response, which is used for paging. For any response, the actual number returned might be less than the specified maxResults.","required":false,"type":"integer"},{"name":"pageToken","in":"query","description":"The continuation token, which is used to page through large result sets. To get the next page of results, set this parameter to the value of \"nextPageToken\" from the previous response.","required":false,"type":"string"}],"responses":{"200":{"description":"A list of activities returned by the request.","schema":{"properties":{"nextPageToken":{"type":"string"},"results":{"type":"array","items":{"type":"string","format":""}},"status":{"type":"string"}}}},"400":{"description":"Your request was malformed, either by missing or incorrect parameters","schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"},"status":{"type":"string"}}}},"429":{"description":"You have used the daily allotment of requests for the provided API Key","schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"},"status":{"type":"string"}}}},"500":{"description":"An unknown error occurred. Please try your request again.","schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"},"status":{"type":"string"}}}}},"deprecated":false},{"id":"e6f18f93.8abfa","type":"swagger-doc","summary":"Google Plus Activities Search Request","description":"Search public activities.","tags":"GooglePlus","consumes":"application/json","produces":"application/json","parameters":[{"name":"accessToken","in":"query","description":"Google provided authorization token.","required":true,"type":"string"},{"name":"query","in":"query","description":"\t  Specify a query string for full text search of public text in all profiles","required":true,"type":"string"},{"name":"language","in":"query","description":"Specify the preferred language to search with.","required":false,"type":"string"},{"name":"maxResults","in":"query","description":"The maximum number of people to include in the response, which is used for paging. For any response, the actual number returned might be less than the specified maxResults.","required":false,"type":"integer"},{"name":"orderBy","in":"query","description":"Specifies how to order search results. Acceptable values are: \"best\": Sort activities by relevance to the user, most relevant first; \"recent\": Sort activities by published date, most recent first. (default)","required":false,"type":"string"},{"name":"pageToken","in":"query","description":"The continuation token, which is used to page through large result sets. To get the next page of results, set this parameter to the value of \"nextPageToken\" from the previous response.","required":false,"type":"string"}],"responses":{"200":{"description":"A list of activities returned by the request.","schema":{"properties":{"nextPageToken":{"type":"string"},"results":{"type":"array","items":{"type":"string","format":""}},"status":{"type":"string"}}}},"400":{"description":"Your request was malformed, either by missing or incorrect parameters","schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"},"status":{"type":"string"}}}},"429":{"description":"You have used the daily allotment of requests for the provided API Key \t","schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"},"status":{"type":"string"}}}},"500":{"description":"An unknown error occurred. Please try your request again.","schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"},"status":{"type":"string"}}}}},"deprecated":false},{"id":"a7b3062e.f42ce8","type":"swagger-doc","summary":"Google Plus Activities Id Request","description":"Get an activity.","tags":"GooglePlus","consumes":"application/json","produces":"application/json","parameters":[{"name":"accessToken","in":"query","description":"Google provided authorization token.","required":true,"type":"string"},{"name":"activityId","in":"query","description":"The ID of the activity to get.","required":true,"type":"string"}],"responses":{"200":{"description":"The activity requested","schema":{"properties":{"actor":{"type":"string"},"id":{"type":"string"},"location":{"type":"string"},"object":{"type":"string"},"published":{"type":"string"},"status":{"type":"string"},"updated":{"type":"string"},"url":{"type":"string"},"verb":{"type":"string"}}}},"400":{"description":"Your request was malformed, either by missing or incorrect parameters","schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"},"status":{"type":"string"}}}},"429":{"description":"You have used the daily allotment of requests for the provided API Key","schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"},"status":{"type":"string"}}}},"500":{"description":"An unknown error occurred. Please try your request again.","schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"},"status":{"type":"string"}}}}},"deprecated":false},{"id":"d72103e9.c7ced","type":"swagger-doc","summary":"Google Plus People List Request","description":"List all of the people in the specified collection.","tags":"GooglePlus","consumes":"application/json","produces":"application/json","parameters":[{"name":"accessToken","in":"query","description":"\t  Google provided authorization token.","required":true,"type":"string"},{"name":"collection","in":"query","description":"The collection of activities to list. Acceptable values are: \"public\": All public activities created by the specified user.","required":true,"type":"string"},{"name":"userId","in":"query","description":"Get the collection of people for the person identified. The special value \"me\" can be used to indicate the authenticated user.","required":true,"type":"string"},{"name":"maxResults","in":"query","description":"The maximum number of people to include in the response, which is used for paging. For any response, the actual number returned might be less than the specified maxResults.","required":false,"type":"integer"},{"name":"orderBy","in":"query","description":"Specifies how to order search results. Acceptable values are: \"best\": Sort activities by relevance to the user, most relevant first; \"recent\": Sort activities by published date, most recent first. (default)","required":false,"type":"string"},{"name":"pageToken","in":"query","description":"The continuation token, which is used to page through large result sets. To get the next page of results, set this parameter to the value of \"nextPageToken\" from the previous response.","required":false,"type":"string"}],"responses":{"200":{"description":"A list of people returned by the request","schema":{"properties":{"nextPageToken":{"type":"string"},"results":{"type":"array","items":{"type":"string","format":""}},"status":{"type":"string"}}}},"400":{"description":"Your request was malformed, either by missing or incorrect parameters","schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"},"status":{"type":"string"}}}},"429":{"description":"You have used the daily allotment of requests for the provided API Key","schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"},"status":{"type":"string"}}}},"500":{"description":"An unknown error occurred. Please try your request again.","schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"},"status":{"type":"string"}}}}},"deprecated":false},{"id":"e2005d64.307008","type":"swagger-doc","summary":"Google Plus People Id Request","description":"Get a person's profile","tags":"GooglePlus","consumes":"application/json","produces":"application/json","parameters":[{"name":"accessToken","in":"query","description":"Google provided authorization token.","required":true,"type":"string"},{"name":"userId","in":"query","description":"The ID of the person to get the profile for. The special value \"me\" can be used to indicate the authenticated user.","required":true,"type":"string"}],"responses":{"200":{"description":"The person represented by the requested profile","schema":{"properties":{"aboutMe":{"type":"string"},"birthday":{"type":"string"},"displayName":{"type":"string"},"emails":{"type":"array","items":{"type":"string","format":""}},"gender":{"type":"string"},"image":{"type":"string"},"isPlusUser":{"type":"boolean"},"name":{"type":"string"},"nickname":{"type":"string"},"occupation":{"type":"string"},"organizations":{"type":"array","items":{"type":"string","format":""}},"placesLived":{"type":"array","items":{"type":"string","format":""}},"relationshipStatus":{"type":"string"},"skills":{"type":"string"},"status":{"type":"string"},"tagline":{"type":"string"},"url":{"type":"string"},"urls":{"type":"array","items":{"type":"string","format":""}}}}},"400":{"description":"Your request was malformed, either by missing or incorrect parameters","schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"},"status":{"type":"string"}}}},"429":{"description":"You have used the daily allotment of requests for the provided API Key","schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"},"status":{"type":"string"}}}},"500":{"description":"An unknown error occurred. Please try your request again.","schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"},"status":{"type":"string"}}}}},"deprecated":false},{"id":"606983c8.a93f3c","type":"swagger-doc","summary":"Google Plus People Search Request","description":"Search all public profiles.","tags":"GooglePlus","consumes":"application/json","produces":"application/json","parameters":[{"name":"accessToken","in":"query","description":"Google provided authorization token.","required":true,"type":"string"},{"name":"query","in":"query","description":"Specify a query string for full text search of public text in all profiles.","required":true,"type":"string"},{"name":"language","in":"query","description":"Specify the preferred language to search with.","required":false,"type":"string"},{"name":"maxResults","in":"query","description":"The maximum number of people to include in the response, which is used for paging. For any response, the actual number returned might be less than the specified maxResults.","required":false,"type":"integer"},{"name":"pageToken","in":"query","description":"\t  The continuation token, which is used to page through large result sets. To get the next page of results, set this parameter to the value of \"nextPageToken\" from the previous response.","required":false,"type":"string"}],"responses":{"200":{"description":"A list of people returned by the request","schema":{"properties":{"nextPageToken":{"type":"string"},"results":{"type":"array","items":{"type":"string","format":""}},"status":{"type":"string"}}}},"400":{"description":"Your request was malformed, either by missing or incorrect parameters","schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"},"status":{"type":"string"}}}},"429":{"description":"You have used the daily allotment of requests for the provided API Key","schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"},"status":{"type":"string"}}}},"500":{"description":"An unknown error occurred. Please try your request again.","schema":{"properties":{"code":{"type":"string"},"error":{"type":"string"},"status":{"type":"string"}}}}},"deprecated":false},{"id":"4c857083.2a5a08","type":"catch","name":"","x":258,"y":542,"z":"8d54db5e.72ab28","wires":[["c2e02882.e353e"]]},{"id":"c2e02882.e353e","type":"function","name":"Move error to http-out","func":"var error = msg._error;\nmsg.payload = error;\nif(error){\n    msg.statusCode = error.code || 500;\n} else{\n    msg.statusCode = 500;\n}\nreturn msg;","outputs":1,"x":483,"y":542,"z":"8d54db5e.72ab28","wires":[["25e16cd6.4a065c"]]},{"id":"25e16cd6.4a065c","type":"http response","name":"","x":673,"y":542,"z":"8d54db5e.72ab28","wires":[]},{"id":"57918d5d.87a174","type":"http in","name":"","url":"/plus/people/search","method":"get","swaggerDoc":"606983c8.a93f3c","x":301,"y":210,"z":"8d54db5e.72ab28","wires":[["135f5d8d.4ba062"]]},{"id":"36af4323.39bf1c","type":"http in","name":"","url":"/plus/people/id","method":"get","swaggerDoc":"e2005d64.307008","x":302,"y":177,"z":"8d54db5e.72ab28","wires":[["80cf8b7b.d8f548"]]},{"id":"cb446681.23cc98","type":"http in","name":"","url":"/plus/people/list","method":"get","swaggerDoc":"d72103e9.c7ced","x":301,"y":242,"z":"8d54db5e.72ab28","wires":[["33f3f8e3.cf86"]]},{"id":"939c5c60.f76fe8","type":"http in","name":"","url":"/plus/activities/id","method":"get","swaggerDoc":"a7b3062e.f42ce8","x":305,"y":280,"z":"8d54db5e.72ab28","wires":[["86482e68.7183b8"]]},{"id":"a26b8bb8.495e3","type":"http in","name":"","url":"/plus/activities/search","method":"get","swaggerDoc":"e6f18f93.8abfa","x":305,"y":311,"z":"8d54db5e.72ab28","wires":[["c51459d1.b7e0f"]]},{"id":"9f4acc22.53566","type":"http in","name":"","url":"/plus/activities/list","method":"get","swaggerDoc":"b231666a.960e98","x":304,"y":342,"z":"8d54db5e.72ab28","wires":[["4dfc8861.001d58"]]},{"id":"392e8bff.089594","type":"http in","name":"","url":"/plus/comments/id","method":"get","swaggerDoc":"f95e9afc.86bec","x":303,"y":389,"z":"8d54db5e.72ab28","wires":[["f7361d37.908bd8"]]},{"id":"2727bf37.9cb018","type":"http in","name":"","url":"/plus/comments/list","method":"get","swaggerDoc":"a7fa0569.e982c8","x":304,"y":422,"z":"8d54db5e.72ab28","wires":[["35665248.4e6e16"]]},{"id":"3b3553d7.aab934","type":"google plus","google":"","name":"","reqType":"people","action":"get","userId":"","activityId":"","commentId":"","collection":"","language":"","maxResults":"","sortOrder":"","orderBy":"","pageToken":"","x":771,"y":172,"z":"8d54db5e.72ab28","wires":[["a52f2e18.4a91"]]},{"id":"29dd2930.e028b6","type":"google plus","google":"","name":"","reqType":"people","action":"search","userId":"","activityId":"","commentId":"","collection":"","language":"","maxResults":"","sortOrder":"","orderBy":"","pageToken":"","x":773,"y":207,"z":"8d54db5e.72ab28","wires":[["a52f2e18.4a91"]]},{"id":"749941fe.ff6f6","type":"google plus","google":"","name":"","reqType":"people","action":"list","userId":"","activityId":"","commentId":"","collection":"","language":"","maxResults":"","sortOrder":"","orderBy":"","pageToken":"","x":772,"y":242,"z":"8d54db5e.72ab28","wires":[["a52f2e18.4a91"]]},{"id":"1c8b67fb.5304d8","type":"google plus","google":"","name":"","reqType":"activities","action":"get","userId":"","activityId":"","commentId":"","collection":"","language":"","maxResults":"","sortOrder":"","orderBy":"","pageToken":"","x":767,"y":284,"z":"8d54db5e.72ab28","wires":[["a52f2e18.4a91"]]},{"id":"aa59817d.2992e","type":"google plus","google":"","name":"","reqType":"activities","action":"search","userId":"","activityId":"","commentId":"","collection":"","language":"","maxResults":"","sortOrder":"","orderBy":"","pageToken":"","x":767,"y":313,"z":"8d54db5e.72ab28","wires":[["a52f2e18.4a91"]]},{"id":"5d8eca6a.e5fe3c","type":"google plus","google":"","name":"","reqType":"activities","action":"list","userId":"","activityId":"","commentId":"","collection":"","language":"","maxResults":"","sortOrder":"","orderBy":"","pageToken":"","x":767,"y":343,"z":"8d54db5e.72ab28","wires":[["a52f2e18.4a91"]]},{"id":"5039bf9d.ec7d98","type":"google plus","google":"","name":"","reqType":"comments","action":"get","userId":"","activityId":"","commentId":"","collection":"","language":"","maxResults":"","sortOrder":"","orderBy":"","pageToken":"","x":772,"y":389,"z":"8d54db5e.72ab28","wires":[["a52f2e18.4a91"]]},{"id":"17603735.a98c11","type":"google plus","google":"","name":"","reqType":"comments","action":"list","userId":"","activityId":"","commentId":"","collection":"","language":"","maxResults":"","sortOrder":"","orderBy":"","pageToken":"","x":774,"y":420,"z":"8d54db5e.72ab28","wires":[["a52f2e18.4a91"]]},{"id":"80cf8b7b.d8f548","type":"function","name":"Move query params to msg","func":"for(var key in msg.req.query){\n    msg[key] = msg.req.query[key];\n}\nreturn msg;","outputs":1,"x":545,"y":173,"z":"8d54db5e.72ab28","wires":[["3b3553d7.aab934"]]},{"id":"135f5d8d.4ba062","type":"function","name":"Move query params to msg","func":"for(var key in msg.req.query){\n    msg[key] = msg.req.query[key];\n}\nreturn msg;","outputs":1,"x":554,"y":207,"z":"8d54db5e.72ab28","wires":[["29dd2930.e028b6"]]},{"id":"33f3f8e3.cf86","type":"function","name":"Move query params to msg","func":"for(var key in msg.req.query){\n    msg[key] = msg.req.query[key];\n}\nreturn msg;","outputs":1,"x":549,"y":241,"z":"8d54db5e.72ab28","wires":[["749941fe.ff6f6"]]},{"id":"86482e68.7183b8","type":"function","name":"Move query params to msg","func":"for(var key in msg.req.query){\n    msg[key] = msg.req.query[key];\n}\nreturn msg;","outputs":1,"x":548,"y":281,"z":"8d54db5e.72ab28","wires":[["1c8b67fb.5304d8"]]},{"id":"c51459d1.b7e0f","type":"function","name":"Move query params to msg","func":"for(var key in msg.req.query){\n    msg[key] = msg.req.query[key];\n}\nreturn msg;","outputs":1,"x":551,"y":317,"z":"8d54db5e.72ab28","wires":[["aa59817d.2992e"]]},{"id":"4dfc8861.001d58","type":"function","name":"Move query params to msg","func":"for(var key in msg.req.query){\n    msg[key] = msg.req.query[key];\n}\nreturn msg;","outputs":1,"x":551,"y":349,"z":"8d54db5e.72ab28","wires":[["5d8eca6a.e5fe3c"]]},{"id":"f7361d37.908bd8","type":"function","name":"Move query params to msg","func":"for(var key in msg.req.query){\n    msg[key] = msg.req.query[key];\n}\nreturn msg;","outputs":1,"x":551,"y":389,"z":"8d54db5e.72ab28","wires":[["5039bf9d.ec7d98"]]},{"id":"35665248.4e6e16","type":"function","name":"Move query params to msg","func":"for(var key in msg.req.query){\n    msg[key] = msg.req.query[key];\n}\nreturn msg;","outputs":1,"x":549,"y":422,"z":"8d54db5e.72ab28","wires":[["17603735.a98c11"]]},{"id":"a52f2e18.4a91","type":"http response","name":"","x":1081.1111373901367,"y":292.22221660614014,"z":"8d54db5e.72ab28","wires":[]}]

Flow Info

Created 9 years, 5 months ago
Updated 8 years, 9 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • catch (x1)
  • function (x9)
  • http in (x8)
  • http response (x2)
Other

Tags

  • Google
  • Plus
  • GooglePlus
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option