Google Business Performance API 的
NEW API 方法可擷取單一 API 要求中的多個「DailyMetrics」。
請詳閱
淘汰時間表和從 v4 reportInsights API 方法遷移至 Google Business Profile Performance API 的操作說明。
使用帳戶資料
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
本教學課程將說明如何使用帳戶資料。My Business Account Management API 可讓您執行下列操作:
事前準備
使用「我的商家帳戶管理」API 前,您必須先註冊應用程式並取得 OAuth 2.0 憑證。
如要進一步瞭解如何開始使用 Business Profile API,請參閱「基本設定」。
列出所有帳戶
如要驗證與已驗證使用者相關聯的帳戶,最好的方法就是列出所有帳戶。使用 accounts.list
API 列出與使用者相關聯的所有帳戶。
如要列出已驗證使用者的所有帳戶,請使用下列指令:
$ GET https://mybusinessaccountmanagement.googleapis.com/v1/accounts
傳回特定帳戶
有時您只想查看已驗證使用者的特定帳戶資訊。使用 accounts.get
API 傳回特定帳戶,並查看其他帳戶詳細資料。
如要依名稱傳回特定帳戶,請使用下列語法:
$ GET https://mybusinessaccountmanagement.googleapis.com/v1/accounts/{accountId}
更新帳戶
變更帳戶名稱是基本的管理工作。使用 accounts.update
API 變更帳戶名稱。
如要依名稱更新特定帳戶,請使用以下方法:
$ PUT https://mybusinessaccountmanagement.googleapis.com/v1/accounts/{accountId}
{
"account": {
"accountName": "Anne Droyd"
},
"languageCode": "en",
"validateOnly": "true"
}
限制
- 帳戶中唯一可編輯的欄位是
accountName
。系統會忽略傳遞的任何其他欄位。
- 只有
BUSINESS
類型的帳戶可以以這種方式更新。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-29 (世界標準時間)。
[null,null,["上次更新時間:2025-08-29 (世界標準時間)。"],[[["\u003cp\u003eThe My Business Account Management API allows you to manage business accounts, including listing all accounts, retrieving specific account details, and updating account names.\u003c/p\u003e\n"],["\u003cp\u003eBefore using the API, you must register your application and obtain OAuth 2.0 credentials as outlined in the basic setup guide.\u003c/p\u003e\n"],["\u003cp\u003eYou can retrieve a list of all accounts associated with an authenticated user or fetch details for a specific account using dedicated API endpoints.\u003c/p\u003e\n"],["\u003cp\u003eUpdating an account is restricted to changing the account name for business type accounts only, with other fields being ignored.\u003c/p\u003e\n"]]],[],null,["# Work with account data\n\n\u003cbr /\u003e\n\nThis tutorial shows you how to work with account data. The My Business Account Management API\nprovides you with the ability to do the following:\n\n- List all accounts.\n- Return a specific account.\n- Update an account.\n\nBefore you begin\n----------------\n\nBefore you use the My Business Account Management API, you need to register your application\nand obtain OAuth 2.0 credentials.\n\nFor details on how to get started with the Business Profile APIs, see\n[Basic setup](/my-business/content/basic-setup).\n\nList all accounts\n-----------------\n\nA great way to validate the accounts associated with an authenticated user is to\nlist all their accounts. Use the [`accounts.list`](/my-business/reference/accountmanagement/rest/v1/accounts/list)\nAPI to list all accounts associated with a user.\n\nTo list all the accounts for an authenticated user, use the following:\nHTTP \n\n```bash\n$ GET https://mybusinessaccountmanagement.googleapis.com/v1/accounts\n```\n\nReturn a specific account\n-------------------------\n\nSometimes, you only want to see information about a specific account for an\nauthenticated user. Use the [`accounts.get`](/my-business/reference/accountmanagement/rest/v1/accounts/get)\nAPI to return a specific account and review additional account details.\n\nTo return a specific account by name, use the following:\nHTTP \n\n```bash\n$ GET https://mybusinessaccountmanagement.googleapis.com/v1/accounts/{accountId}\n```\n\nUpdate an account\n-----------------\n\nChanging an account name is a fundamental administrative task. Use the\n[`accounts.update`](/my-business/reference/accountmanagement/rest/v1/accounts/patch) API to alter\nthe account name.\n\nTo update a specific account by name, use the following:\nHTTP \n\n```bash\n$ PUT https://mybusinessaccountmanagement.googleapis.com/v1/accounts/{accountId}\n\n{\n \"account\": {\n \"accountName\": \"Anne Droyd\"\n },\n \"languageCode\": \"en\",\n \"validateOnly\": \"true\"\n}\n```\n\n### Restrictions\n\n- The only editable field for an account is `accountName`. Any other fields passed are ignored.\n- Only accounts of `BUSINESS` type can be updated in this manner."]]