تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
تتيح Google Ads API ربط فيديوهات YouTube بحسابك على "إعلانات Google". يوضّح هذا الدليل كيفية استخدام واجهة برمجة التطبيقات لإضافة روابط إلى حسابك وإزالتها.
ربط الفيديوهات
يمكن ربط الفيديوهات بحسابك بإحدى الطريقتَين التاليتَين، وذلك حسب الجهة التي تبدأ العملية:
تطلب ربط فيديو بحسابك. في هذه الحالة، عليك إرسال طلب إلى صانع محتوى، وعليه قبول الطلب لإنشاء رابط إلى الفيديو الذي يقدّمه. يمكنك إلغاء طلب تم تمديده قبل قبوله، ويمكنك أيضًا إزالة فيديو مرتبط بعد قبوله.
يطلب صانع المحتوى ربط الفيديو بحسابك على "إعلانات Google". يمكنك بعد ذلك اختيار قبول الطلب أو رفضه.
يتم استخدام الطرق التالية في كل سيناريو:
السيناريو
الإجراء
الملاحظات
السيناريو 1
الحصول على معلومات الفيديو من YouTube API
استخدِم YouTube API
للحصول على channel_id لإرسال طلب رابط الفيديو إليه، أو video_id
للفيديو الذي تريد ربطه. يمكن أيضًا استخراج video_id من عنوان URL الخاص بفيديو من خلال استخراج الأحرف الأحد عشر التي تلي "v=".
إنشاء طلب ربط حساب
استخدِم طريقة DataLinkService.CreateDataLink لإنشاء طلب ربط حساب. يجب عدم ضبط قيمة status
في DataLink،
إذ سيضبط خادم Google Ads API هذه القيمة على REQUESTED عند
إكمال طلب البيانات من واجهة برمجة التطبيقات بنجاح.
تاريخ التعديل الأخير: 2025-09-05 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","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"]],["تاريخ التعديل الأخير: 2025-09-05 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["# Link YouTube\n\nThe Google Ads API supports linking YouTube videos to your Google Ads account. This guide\nexplains how to use the API to add and remove links to your account.\n\nLink videos\n-----------\n\nVideos can be linked to your account in one of two ways, depending on who starts\nthe process, either:\n\n1. You request that a video is linked to your account. In this scenario, you send a request to a creator, which they must accept in order to establish the link to their video. You can revoke a request that has been extended before it's accepted, and also remove a linked video after it's accepted.\n2. The creator of the video requests that their video is linked to your Google Ads account. You can then choose to accept or reject their request.\n\nThe following methods are used in each scenario:\n\n| Scenario | Action | Remarks |\n| Scenario 1 | Get the video information from the YouTube API | Use the [YouTube API](https://developers.google.com/youtube/v3/docs/channels/list) to get the `channel_id` to send the video link request to, or the `video_id` of the video you want to link. The `video_id` can also be pulled from the URL of a video by pulling the 11 characters after `\"v=\"`. |\n| Scenario 1 |\n| Scenario 1 |\n| Scenario 1 |\n| Scenario 1 |\n|---------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Create a link request | Use the [`DataLinkService.CreateDataLink`](/google-ads/api/reference/rpc/v21/DataLinkService/CreateDataLink) method to create a link request. The [`status`](/google-ads/api/reference/rpc/v21/DataLink#status) of the [`DataLink`](/google-ads/api/reference/rpc/v21/DataLink) shouldn't be set; the Google Ads API server will set this to `REQUESTED` upon the successful completion of the API call. |\n| Inspect the status of a request | Use [`GoogleAdsService.SearchStream`](/google-ads/api/reference/rpc/v21/GoogleAdsService/SearchStream) or [`GoogleAdsService.Search`](/google-ads/api/reference/rpc/v21/GoogleAdsService/Search) to query the [`data_link`](/google-ads/api/fields/v21/data_link) resource and inspect its [`status`](/google-ads/api/fields/v21/data_link#data_link.status). |\n| Revoke a request | Use the [`DataLinkService.UpdateDataLink`](/google-ads/api/reference/rpc/v21/DataLinkService/UpdateDataLink) method to revoke a link request by changing the [`status`](/google-ads/api/reference/rpc/v21/DataLink#status) of the [`DataLink`](/google-ads/api/reference/rpc/v21/DataLink) from `REQUESTED` to `REVOKED`. |\n| Remove a link | Use [`DataLinkService.RemoveDataLink`](/google-ads/api/reference/rpc/v21/DataLinkService/RemoveDataLink) to remove a linked video. |\n| Accept or reject a link request | Use the [`DataLinkService.UpdateDataLink`](/google-ads/api/reference/rpc/v21/DataLinkService/UpdateDataLink) method to update the status of the [`DataLink`](/google-ads/api/reference/rpc/v21/DataLink) to `ENABLED` to accept or `REJECTED` to reject the request. |\n\nThe following common errors can be thrown in this workflow:\n\n| Error code | Explanation |\n|----------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------|\n| [`DataLinkError.PERMISSION_DENIED`](/google-ads/api/reference/rpc/v21/DataLinkErrorEnum.DataLinkError#permission_denied) | The customer doesn't have the permission to perform this action. |\n| [`DataLinkError.YOUTUBE_VIDEO_ID_INVALID`](/google-ads/api/reference/rpc/v21/DataLinkErrorEnum.DataLinkError#youtube_video_id_invalid) | A video link couldn't be created, since the video ID is invalid. |"]]