資源名稱
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
Google Ads API 中實體的專屬 ID 稱為「資源名稱」,以可預測格式的字串表示。如果您知道資源名稱的組成元件,可以使用這項公用程式產生最終資源名稱。
ResourceNames 類別
如果您知道與實體相關的所有 ID,可以使用 ResourceNames
類別建構實體的資源名稱。舉例來說,廣告活動資源名稱的格式為 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-26 (世界標準時間)。
[null,null,["上次更新時間:2025-08-26 (世界標準時間)。"],[[["\u003cp\u003eThe Google Ads API client library for .NET will drop support for .NET 5.0 starting with version 19.0.0, urging users to upgrade to a newer version.\u003c/p\u003e\n"],["\u003cp\u003eResource names are unique identifiers for entities in the Google Ads API, following a predictable format based on the entity's components.\u003c/p\u003e\n"],["\u003cp\u003eYou can easily construct resource names using the \u003ccode\u003eResourceNames\u003c/code\u003e class if you know the necessary IDs, such as customer and campaign IDs.\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`customers/{customer_id}/campaigns/{campaign_id}`, so if you know the customer\nID and the campaign ID, you can use the `ResourceNames` class construct the full\nresource 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."]]