Google Business Performance API 的 NEW API 方法可擷取單一 API 要求中的多個「DailyMetrics」。 請詳閱淘汰時間表和從 v4 reportInsights API 方法遷移至 Google Business Profile Performance API 的操作說明。
您的應用程式必須透過任何存取私人使用者資料的商家檔案 API 要求,傳送 OAuth 2.0 憑證。
如果您尚未建立,請前往 Google API 控制台的「憑證」部分,然後依序點選「建立憑證」>「OAuth 用戶端 ID」,建立 OAuth 2.0 憑證。建立憑證後,您可以在「Credentials」(憑證) 頁面上看到用戶端 ID。按一下用戶端 ID 即可查看詳細資料,例如用戶端密鑰、重新導向 URI、JavaScript 來源地址和電子郵件地址。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-08-29 (世界標準時間)。"],[[["\u003cp\u003eBefore using Business Profile APIs, ensure project approval and enable the eight associated APIs in the Google API Console.\u003c/p\u003e\n"],["\u003cp\u003eObtain an OAuth 2.0 client ID for your application to authorize access to location data.\u003c/p\u003e\n"],["\u003cp\u003eUnderstand REST basics and JSON format to interact with the APIs via HTTP requests and responses.\u003c/p\u003e\n"],["\u003cp\u003eUtilize the OAuth Playground for experimenting with API calls, and consider using client libraries for simplified interaction.\u003c/p\u003e\n"],["\u003cp\u003eThere is no sandbox environment for testing API calls; use \u003ccode\u003evalidateOnly\u003c/code\u003e parameter for request validation without data modification.\u003c/p\u003e\n"]]],["To begin using Business Profile APIs, ensure prerequisites are met and project access is approved. Enable eight specified APIs in the Google API Console. If you're a Google workspace user, make sure Google Business Profile is enabled. Generate an OAuth 2.0 client ID for secure data access. Understand REST basics, using HTTP verbs (GET, POST, PUT, DELETE) with unique URIs, and learn the structure of JSON, the data format used. Utilize the OAuth 2.0 Playground for testing; the client libraries can also be used.\n"],null,["# Basic setup\n\nTo proceed, make sure you've completed the steps in\n[Prerequisites](/my-business/content/prereqs) and that we've approved your project for Business Profile\nAPIs access.\n\nEnable the APIs\n---------------\n\n| **Note:** The Google My Business API is only visible in the Google API Console to users who submit and receive approval for their Google Account through the access request form. For more details, see [Request access to the APIs](/my-business/content/prereqs#request-access).\n\n\nThere are eight APIs associated with Business Profile that must be enabled in the Google API\nConsole:\n\n- Google My Business API\n- My Business Account Management API\n- My Business Lodging API\n- My Business Place Actions API\n- My Business Notifications API\n- My Business Verifications API\n- My Business Business Information API\n- My Business Q\\&A API\n\n### Enable an API\n\nIf you've completed all of the\n[Prerequisites](/my-business/content/prereqs) and have been granted access to the API, but are still unable\nto use the provided shortcut, you can enable the API manually with the following steps.\n\n\nTo enable an API for your project, do the following:\n\n1. [Open the API Library](https://console.cloud.google.com/apis/library) in the Google API Console. If prompted, select a project or create a new one. The API Library lists all available APIs, grouped by product family and popularity.\n2. If the API you want to enable isn't visible in the list, use search to find it.\n3. Select the API you want to enable, then click the **Enable** button.\n4. If prompted, enable billing.\n5. If prompted, accept the API's Terms of Service.\n\nIf you are a **Google workspace user** , confirm that [Google Business Profile is turned on for your account](https://support.google.com/a/answer/10623799) in your Google workspace organization. You will get \\`error 403 - PERMISSION DENIED\\` when using the GBP APIs if Google Business Profile is turned off for your account in your Google workspace organization.\n\nRequest an OAuth 2.0 client ID\n------------------------------\n\nBecause your app accesses protected, non-public data, you need an\n[OAuth 2.0](/identity/protocols/OAuth2) client ID. This lets your app request\nauthorization to access your organization's location data on behalf of your app's users.\n\nYour application must send an OAuth 2.0 token with any Business Profile APIs request\nthat accesses private user data.\n\nIf you haven't done so already, go to the \"Credentials\" section of the\n[Google API Console](https://console.developers.google.com/apis/credentials) and click\n**Create credentials \\\u003e OAuth client ID** to create your OAuth 2.0 credentials. After you've\ncreated the credentials, you can see your client ID on the **Credentials** page. Click the\nclient ID for details, such as client secret, redirect URIs, JavaScript origins address, and email\naddress.\n\nLearn REST basics\n-----------------\n\nThere are two ways to invoke the APIs:\n\n- Send an HTTP request and parse the responses.\n- Use [client libraries](/my-business/samples).\n\nIf you decide not to use client libraries, you need to understand the basics of REST.\n\nREST is a style of software architecture that provides a convenient and consistent approach to\nrequest and modify data.\n\nThe term REST is short for\n\"[Representational State Transfer](https://en.wikipedia.org/wiki/Representational_state_transfer).\" In the context of Google APIs, it refers\nto the use of HTTP verbs to retrieve and modify representations of data stored by Google.\n\nA RESTful system stores resources in a data store. A client sends a request for the\nserver to perform a particular action, such as to create, retrieve, update, or delete a resource,\nand the server performs the action and sends a response. That response is often in the form of a\nrepresentation of the specified resource.\n\nIn Google's RESTful APIs, the client specifies an action with an HTTP verb, such as\n`GET`, `POST`, `PUT`, or `DELETE`. The client specifies\na resource by a globally unique uniform resource identifier (URI) of the following form: \n\n```\nhttps://apiName.googleapis.com/apiVersion/resourcePath?parameters\n```\n\nBecause all API resources have unique HTTP-accessible URIs, REST enables data caching and is\noptimized to work with the web's distributed infrastructure.\n\nYou might find the\n[method definitions](https://tools.ietf.org/html/rfc7231#section-4.3) in the HTTP 1.1 standards documentation\nuseful. They include specifications for `GET`, `POST`, `PUT`, and\n`DELETE`.\n\nREST in the Business Profile APIs\n---------------------------------\n\nThe Business Profile APIs operations map directly to REST HTTP verbs.\n\nThe specific format for the Business Profile APIs is shown in the following URI: \n\n```\nhttps://apiName.googleapis.com/apiVersion/resourcePath?parameters\n```\n\nThe full set of URIs used for each supported operation in the APIs appears in the Business Profile APIs\n[Reference](/my-business/reference/rest) documentation.\n\nResource paths vary based on the endpoint.\n\nFor example, the resource path to an account appears as in the following example: \n\n accounts/accountId\n\nThe resource path for a location appears in the following form: \n\n locations/locationId\n\nLearn JSON basics\n-----------------\n\nThe Business Profile APIs return data in JSON format.\n\nJavaScript Object Notation ([JSON](http://en.wikipedia.org/wiki/JSON)) is a common, language-independent data format that\nprovides a simple text representation of arbitrary data structures. For more information, see\n[json.org](http://www.json.org/).\n\nUse Oauth Playground to make a simple HTTP request\n--------------------------------------------------\n\nYou can use the\n[OAuth 2.0 Playground](https://developers.google.com/oauthplayground)\nto experiment with the Business Profile APIs. Because the Business Profile APIs\naren't public APIs, there are a few extra steps you need to take to use it in the Playground. You\nneed a client ID for a web application to proceed.\n\n1. Go to the [Google API Console](https://console.developers.google.com/apis/credentials) and open your project. If you don't have an OAuth client ID for web applications, create one now:\n 1. From the *Create credentials* drop-down list, select **OAuth client ID**.\n 2. For *Application type* , click **Web Application**.\n 3. Add the following as a valid redirect URI:\n\n ```\n https://developers.google.com/oauthplayground\n \n ```\n 4. Click **Create**.\n2. Copy the client ID to the clipboard.\n3. Go to [OAuth 2.0 Playground](https://developers.google.com/oauthplayground).\n4. Click the gear icon to open the configuration options and make the following changes:\n 1. Set *OAuth flow* to **Client-side**.\n 2. Select **Use your own OAuth credentials**.\n 3. Paste in your OAuth client ID.\n5. Close the configuration options.\n6. Under \"Step 1 - Select \\& authorize APIs,\" paste the following scope for the\n Business Profile APIs into the *Input your own scopes* field:\n\n ```\n https://www.googleapis.com/auth/business.manage\n ```\n7. Click **Authorize APIs**.\n8. Click **Accept** when prompted.\n9. Under \"Step 2 - Configure request to API,\" paste the following URI into the\n *Request URI* field:\n\n ```\n https://mybusinessaccountmanagement.googleapis.com/v1/accounts\n ```\n10. Click **Send the request** . The response should show a status of `200 OK`.\n\nFor more information about how to make various types of requests, see\nthe [Business Profile APIs Reference](/my-business/reference/rest).\n| **Note:** There's no Sandbox environment for the Business Profile APIs. Some calls allow for a `validateOnly` query parameter that, when set to `true`, validates a request without changes made.\n| **Note:** The OAuth 2.0 playground automatically adds debugging headers. If you use a different client and would like to view detailed error messages in the response, add the following header to the request: `X-GOOG-API-FORMAT-VERSION: 2`\n\nClient libraries\n----------------\n\nThe Business Profile APIs client libraries support the functionality of the Business Profile APIs. They provide\nfunctionality common to all Google APIs, such as HTTP transport, error handling, authentication,\nand JSON parsing.\n\nTo download client libraries, see [Libraries](/my-business/samples)."]]