資源名稱
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
在 Google Ads API 中,實體的專屬 ID 稱為資源
名稱,並顯示為具有可預測格式的字串。如果您知道
您可以使用此公用程式
產生最終資源名稱
ResourceNames 類別
ResourceNames
類別是建構實體資源名稱的方法
若您知道該實體的所有相關 ID舉例來說
廣告活動資源名稱的格式如下:
customers/{customer_id}/campaigns/{campaign_id}
因此如果您知道客戶 ID 和廣告活動 ID,就可以使用
ResourceNames
類別會以下列方式建構完整的資源名稱:
String campaignResourceName = ResourceNames.campaign(customerId, campaignId);
您也可以使用其他實體名稱,其 ID 會根據
資源名稱的最終形式
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-21 (世界標準時間)。
[null,null,["上次更新時間:2025-08-21 (世界標準時間)。"],[[["\u003cp\u003eThe Google Ads API uses unique identifiers called resource names to represent entities.\u003c/p\u003e\n"],["\u003cp\u003eResource names follow a predictable format and can be generated using their components.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eResourceNames\u003c/code\u003e class allows you to construct a resource name using relevant IDs, such as customer ID and campaign ID.\u003c/p\u003e\n"],["\u003cp\u003eUsing entity names like \u003ccode\u003ecampaign\u003c/code\u003e with appropriate IDs in the \u003ccode\u003eResourceNames\u003c/code\u003e class generates the full resource name string.\u003c/p\u003e\n"]]],[],null,["# Resource Names\n\nThe unique identifier for an entity in the Google Ads API is called a resource\nname, and is represented as a string with a predictable format. If you know\nthe constituent components of a resource name, you can use this utility to\ngenerate the final resource name.\n\nResourceNames class\n-------------------\n\nThe `ResourceNames` class is a way to construct the resource name of an entity\nif you know all of the relevant IDs related to that entity. For example, a\ncampaign resource name is in the format: \n\n customers/{customer_id}/campaigns/{campaign_id}\n\nSo if you know the customer ID and the campaign ID, you can use the\n`ResourceNames` class construct the full resource name as follows: \n\n String campaignResourceName = ResourceNames.campaign(customerId, campaignId);\n\nYou can use other entity names as well, which take different IDs depending on\nthe final form of the resource name."]]