Dịch vụ Display & Video 360
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.
Dịch vụ Display & Video 360 (DV360) cho phép bạn sử dụng DV360 API trong Apps Script. API này cung cấp quyền truy cập theo phương pháp có lập trình vào Display & Video API.
Tài liệu tham khảo
Để biết thông tin chi tiết về dịch vụ này, hãy xem tài liệu tham khảo cho DV360 API. Giống như tất cả các dịch vụ nâng cao trong Apps Script, dịch vụ DV360 sử dụng các đối tượng, phương thức và tham số giống như API công khai. Để biết thêm thông tin, hãy xem bài viết Cách xác định chữ ký phương thức.
Để báo cáo vấn đề và tìm thông tin hỗ trợ khác, hãy xem hướng dẫn hỗ trợ DV360.
Mã mẫu
Mã mẫu sau đây sử dụng phiên bản 4 của API.
Lấy danh sách đối tác
Mẫu này ghi lại tất cả các đối tác có trong tài khoản.
Nhận danh sách các chiến dịch đang hoạt động
Mẫu này ghi lại tên và mã nhận dạng của tất cả chiến dịch đang hoạt động. Lưu ý việc sử dụng mã thông báo phân trang để truy xuất toàn bộ danh sách.
Cập nhật tên hiển thị của một mục hàng
Mẫu này cập nhật tên hiển thị của một mục hàng
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-31 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-08-31 UTC."],[],[],null,["# Display & Video 360 Service\n\nThe Display \\& Video 360 (DV360) service lets you use the\n[DV360 API](/display-video)\nin Apps Script. This API provides programmatic access to the Display \\& Video API.\n| **Note:** This is an advanced service that must be [enabled before use](/apps-script/guides/services/advanced).\n\nReference\n---------\n\nFor detailed information on this service, see the\n[reference documentation](/display-video/api/reference/rest) for the\nDV360 API. Like all advanced services in Apps\nScript, the DV360 service uses the same objects, methods, and\nparameters as the public API. For more information, see [How method signatures are determined](/apps-script/guides/services/advanced#how_method_signatures_are_determined).\n\nTo report issues and find other support, see the\n[DV360 support guide](/display-video/api/support).\n\nSample code\n-----------\n\nThe following sample code uses\n[version 4](/display-video/api/reference/rest/v4) of the API.\n\n### Get a list of partners\n\nThis sample logs all of the partners available in the account. \nadvanced/displayvideo.gs \n[View on GitHub](https://github.com/googleworkspace/apps-script-samples/blob/main/advanced/displayvideo.gs) \n\n```javascript\n/**\n * Logs all of the partners available in the account.\n */\nfunction listPartners() {\n // Retrieve the list of available partners\n try {\n const partners = DisplayVideo.Partners.list();\n\n if (partners.partners) {\n // Print out the ID and name of each\n for (let i = 0; i \u003c partners.partners.length; i++) {\n const partner = partners.partners[i];\n console.log('Found partner with ID %s and name \"%s\".',\n partner.partnerId, partner.displayName);\n }\n }\n } catch (e) {\n // TODO (Developer) - Handle exception\n console.log('Failed with error: %s', e.error);\n }\n}\n```\n\n### Get a list of active campaigns\n\nThis sample logs names and IDs of all active campaigns. Note the use of\npaging tokens to retrieve the whole list. \nadvanced/displayvideo.gs \n[View on GitHub](https://github.com/googleworkspace/apps-script-samples/blob/main/advanced/displayvideo.gs) \n\n```javascript\n/**\n * Logs names and ID's of all active campaigns.\n * Note the use of paging tokens to retrieve the whole list.\n */\nfunction listActiveCampaigns() {\n const advertiserId = '1234567'; // Replace with your advertiser ID.\n let result;\n let pageToken;\n try {\n do {\n result = DisplayVideo.Advertisers.Campaigns.list(advertiserId, {\n 'filter': 'entityStatus=\"ENTITY_STATUS_ACTIVE\"',\n 'pageToken': pageToken\n });\n if (result.campaigns) {\n for (let i = 0; i \u003c result.campaigns.length; i++) {\n const campaign = result.campaigns[i];\n console.log('Found campaign with ID %s and name \"%s\".',\n campaign.campaignId, campaign.displayName);\n }\n }\n pageToken = result.nextPageToken;\n } while (pageToken);\n } catch (e) {\n // TODO (Developer) - Handle exception\n console.log('Failed with error: %s', e.error);\n }\n}\n```\n\n### Update the display name of a line item\n\nThis sample updates the display name of a line item \nadvanced/displayvideo.gs \n[View on GitHub](https://github.com/googleworkspace/apps-script-samples/blob/main/advanced/displayvideo.gs) \n\n```javascript\n/**\n * Updates the display name of a line item\n */\nfunction updateLineItemName() {\n const advertiserId = '1234567'; // Replace with your advertiser ID.\n const lineItemId = '123456789'; //Replace with your line item ID.\n const updateMask = \"displayName\";\n\n const lineItemDef = {displayName: 'New Line Item Name (updated from Apps Script!)'};\n\n try {\n const lineItem = DisplayVideo.Advertisers.LineItems\n .patch(lineItemDef, advertiserId, lineItemId, {updateMask:updateMask});\n\n\n } catch (e) {\n // TODO (Developer) - Handle exception\n console.log('Failed with error: %s', e.error);\n }\n}\n```"]]