Google – Reviews

前言

继上一篇 Facebook – Reviews (Graph API) 后, 这篇继续介绍另一个 Reviews 大平台 Google Reviews.

想通过 API 获取 Google Reviews 难度比 Facebook Reviews 高了一个量级哦!

 

参考

Docs – Work with review data

 

概念

要想通过 API 获取 Google Business Reviews.

需要 integrate 整套 OAuth 和 Business Profile APIs.

Google 这套机制是为 Third Party 公司设计的. 如果我们的需求只是想把公司的 Reviews 拉下来放到网站做展现. 真的是小题大做. 但也没有其它办法了.

关于 OAuth 的机制可以看这篇 Identity – 安全基础知识, Google 使用的是 OAuth 2.0 + authorization code flow.

简单说就是 User 访问 App, 然后登入 Google 账号并授权给 App 让 App 有权限访问 Google Reviews.

这个 App 就是网站, User 就是公司老板, Google Reviews 就是公司的 Reviews.

 

Prerequisites

参考: Docs – Prerequisites

1. 需要有一个 Google Account (最好是有给钱的 workspace, 下面会提到好处)

2. 开通 Google Cloud (要有一个 Project), 之前介绍 Google Maps Embed API & JavaScript API 也是需要 Google Cloud, 可以回去参考以下.

3. 需要开通 Google Business (这个自然啦, 不然那来的 reviews 呢)

4. 需要提交申请, 这个超级麻烦的咯...

到 Business Profile APIs: Application Form For Basic Access 填写表格.

有几个地方要特别注意

1. Project ID & Number 

它指的是 Google Cloud Project 的 ID 和 Number

到 Google Cloud > 选定 Project > Project settings

这里

2. Your Email

这个 email 必须和网站 domain 一致. @gmail, @hotmail 都不行.

3.Third-party / Agency

third-party 就表示, App 不是企业网站, 而是一个让 User 管理 Google Reviews 的 Web App.

我的项目自然是选 Local Business 了.

4. 提交后 Confirmation

提交后几天, Google 会发一封 confirmation email 到上面的电邮地址.

reply confirm 后, 几天内就会收到申请成功的通知

 

Basic setup

参考: Docs – Basic setup

申请批准以后, 我们就可以开始一些 basic setup 了 (before 我们发送 Reviews API)

Enable the APIs

首先要去 Google Cloud enable API, 这个和做 Google Map 类似, 都是要先 enable 才可以用

下面这些全部都要 enable

  • Google My Business API
  • My Business Account Management API
  • My Business Lodging API
  • My Business Place Actions API
  • My Business Notifications API
  • My Business Verifications API
  • My Business Business Information API
  • My Business Q&A API

到 Google Cloud > Apis & Services > Library

搜索

点击 enable (我已经 enable 了所以变成 manage)

 

记得, 全部都要 enable 哦.

OAuth 2.0 Setup

接着要去 Google Cloud 创建 App 获取 Client ID 和 Secret 了.

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章