假設帳戶 A 的使用者透過 ThirdPartyAppAnalyticsLink,將實體的讀取和編輯存取權提供給帳戶 B。連結完成後,帳戶 B 的使用者即可對帳戶 A 進行 API 呼叫,但須遵守連結提供的權限。在這種情況下,帳戶 A 的 API 呼叫權限取決於帳戶 B 的第三方連結,而非其他 API 呼叫中使用的管理員帳戶關係。
第三方應用程式分析供應商會發出下列 API 呼叫:
linked-customer-id:上傳資料的第三方應用程式數據分析帳戶 (帳戶 B)。
customer-id:上傳資料的 Google Ads 帳戶 (帳戶
A)。
login-customer-id 和 Authorization 標頭:用來識別有權存取帳戶 B 的使用者。
[[["容易理解","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-26 (世界標準時間)。"],[[["\u003cp\u003eThis guide outlines the common structure of all Google Ads API calls, including request details for both gRPC (preferred) and REST (optional) methods.\u003c/p\u003e\n"],["\u003cp\u003eResource names act as identifiers for most API objects and are used as URLs in the REST interface.\u003c/p\u003e\n"],["\u003cp\u003eComposite IDs are used for objects without globally unique IDs, created by combining the parent ID and the object's ID.\u003c/p\u003e\n"],["\u003cp\u003eEssential request headers include \u003ccode\u003eAuthorization\u003c/code\u003e for authentication, \u003ccode\u003edeveloper-token\u003c/code\u003e for developer identification, and \u003ccode\u003elogin-customer-id\u003c/code\u003e to specify the customer account context.\u003c/p\u003e\n"],["\u003cp\u003eImportant response headers, like \u003ccode\u003erequest-id\u003c/code\u003e, are returned for debugging purposes.\u003c/p\u003e\n"]]],[],null,["# API Call Structure\n\nThis guide describes the common structure of all API calls.\n\nIf you're using a client library to interact with the API, you won't\nneed to know the underlying request details. However,\nsome knowledge about the API call structure can come in handy when testing and\ndebugging.\n\nGoogle Ads API is a [gRPC API](//grpc.io/docs/guides/), with REST bindings. This means\nthat there are two ways of making calls to the API.\n\n**Preferred**:\n\n1. Create the body of the request as a\n [protocol buffer](/protocol-buffers).\n\n2. Send it to the server using [HTTP/2](//http2.github.io/).\n\n3. Deserialize the response to a protocol buffer.\n\n4. Interpret the results.\n\nMost of our documentation describes [using gRPC](/google-ads/api/reference/rpc/v21).\n\n**Optional**:\n\n1. Create the body of request as a [JSON](//www.json.org/) object.\n\n2. Send it to the server using HTTP 1.1.\n\n3. Deserialize the response as a JSON object.\n\n4. Interpret the results.\n\nRefer to the [REST interface](/google-ads/api/rest/overview) guide for more information\non using REST.\n| **Note:** This guide describes the structure and transport headers common to both gRPC and REST protocols.\n\n### Resource names\n\nMost objects in the API are identified by their resource name strings. These\nstrings also serve as URLs when using the REST interface. See the REST\ninterface's [Resource Names](/google-ads/api/rest/design/resource-names) for their\nstructure.\n| **Key Point:** Check out the [resources documentation](/google-ads/api/reference/rpc/v21/overview#resources), for all supported resources and their path representation (`resource_name`). The same format is used for other services.\n\n### Composite IDs\n\nIf the ID of an object is not globally unique, a composite ID for that object\nis constructed by prepending its parent ID and a tilde (\\~).\n\nFor example, since an ad group ad ID is not globally unique, we prepend its\nparent object (ad group) ID to it to make a unique composite ID:\n\n- `AdGroupId` of **`123`** + `~` + `AdGroupAdId` of **`45678`** = composite ad group ad ID of **`123~45678`**.\n\nRequest headers\n---------------\n\nThese are the HTTP headers (or [grpc\nmetadata](//grpc.io/docs/what-is-grpc/core-concepts/#metadata)) that accompany\nthe body in the request:\n\n### Authorization\n\nYou must include an OAuth2 access token in the form of\n`Authorization: Bearer YOUR_ACCESS_TOKEN` that identifies either a\nmanager account acting on behalf of a client, or an advertiser directly\nmanaging their own account. Directions for retrieving an access token\ncan be found in the [OAuth2 guide](/google-ads/api/docs/oauth/overview). An access token is\nvalid for an hour after you acquire it; when it expires, refresh the access\ntoken to retrieve a new one. Note that our client libraries automatically\nrefresh expired tokens.\n\n### developer-token\n\nA developer token is a 22-character string that uniquely identifies a\nGoogle Ads API developer. An example developer token string is\n`ABcdeFGH93KL-NOPQ_STUv`. The developer token should be included in the\nform of `developer-token : ABcdeFGH93KL-NOPQ_STUv`.\n\n### login-customer-id\n\nThis is the customer ID of the authorized customer to use in the request,\nwithout hyphens (`-`). If your access to the customer account is through a\nmanager account, this header is *required* and must be set to the customer ID of\nthe manager account.\n**Key Term:** The **operating customer** is the customer ID in the request payload. For example, the operating customer in the following [`CampaignBudgetService`](/google-ads/api/reference/rpc/v21/CampaignBudgetService) request is `1234567890`: \n\n```text\nhttps://googleads.googleapis.com/v21/customers/1234567890/campaignBudgets:mutate\n```\n\nSetting the `login-customer-id` is equivalent to choosing an account in the\nGoogle Ads UI after signing in or clicking on your profile image at the top\nright. If you don't include this header, it defaults to the **operating\ncustomer**.\n| **Note:** You can retrieve the list of accounts that are *directly* accessible with your OAuth credentials by issuing a [`CustomerService.ListAccessibleCustomers`](/google-ads/api/reference/rpc/v21/CustomerService/ListAccessibleCustomers) request. The `login-customer-id` is not required for this request type, and has no effect on the list of customers returned.\n\n### linked-customer-id\n\nThis header is only used by \\[third-party app analytics providers when\nuploading conversions to a\n[linked Google Ads account](//support.google.com/google-ads/answer/7365001).\n\nConsider the scenario where users on account `A` provide read and edit access\nto its entities to account `B` through a\n[`ThirdPartyAppAnalyticsLink`](/google-ads/api/reference/rpc/v21/ThirdPartyAppAnalyticsLink).\nOnce linked, a user on account `B` can make API calls against account `A`,\nsubject to the permissions provided by the link. In this case, the API-calling\npermissions to account `A` are determined by the third-party link to account\n`B`, rather than the manager-account relationship that is used in other API\ncalls.\n\nThe third-party app analytics provider makes an API call as follows:\n\n- `linked-customer-id`: The third-party app analytics account that uploads the data (account `B`).\n- `customer-id`: The Google Ads account to which data is uploaded (account `A`).\n- `login-customer-id` and `Authorization` header: A combination of values to identify a user who has access to account `B`.\n\nResponse headers\n----------------\n\nThe following headers (or\n[grpc trailing-metadata](//grpc.io/docs/what-is-grpc/core-concepts/#metadata))\nare returned with the response body. We recommend that you log these\nvalues for debugging purposes.\n\n### request-id\n\nThe `request-id` is a string that uniquely identifies this request."]]