Tên tài nguyên
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Giá trị nhận dạng duy nhất của một thực thể trong API Google Ads được gọi là tài nguyên
và được biểu thị dưới dạng một chuỗi có định dạng có thể dự đoán được. Nếu bạn biết
các thành phần cấu thành của tên tài nguyên, bạn có thể sử dụng phần mềm tiện ích này để
tạo tên tài nguyên cuối cùng.
Lớp ResourceNames
Lớp ResourceNames
là một cách để tạo tên tài nguyên của một thực thể
nếu bạn biết tất cả các mã nhận dạng có liên quan đến pháp nhân đó. Ví dụ: một
tên tài nguyên chiến dịch có định dạng:
customers/{customer_id}/campaigns/{campaign_id}
Vì vậy, nếu biết mã khách hàng và mã chiến dịch, bạn có thể sử dụng
Lớp ResourceNames
tạo tên tài nguyên đầy đủ như sau:
String campaignResourceName = ResourceNames.campaign(customerId, campaignId);
Bạn cũng có thể sử dụng các tên pháp nhân khác, lấy các mã nhận dạng khác nhau, tuỳ thuộc vào
dạng cuối cùng của tên tài nguyên.
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-08-21 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-08-21 UTC."],[[["\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."]]