假设账号 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"]],["最后更新时间 (UTC):2025-09-05。"],[[["\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."]]