הרשימה הבאה מציגה תרחישים לדוגמה נפוצים לשימוש בשיטה זו. מעבירים את העכבר מעל תרחיש לדוגמה כדי לראות את התיאור שלו, או לוחצים על תרחיש לדוגמה כדי לטעון ערכי פרמטרים לדוגמה ב-API Explorer. אתם יכולים לפתוח את APIs Explorer במסך מלא כדי לראות דוגמאות קוד שמתעדכנות באופן דינמי כדי לשקף את ערכי הפרמטרים שהוזנו ב-Explorer.
הטבלה הבאה מציגה תרחישים לדוגמה נפוצים לשימוש בשיטה הזו. אפשר ללחוץ על שם של תרחיש לדוגמה כדי לטעון ערכי פרמטרים לדוגמה ב-API Explorer. לחלופין, אפשר לראות דוגמאות קוד לתרחיש לדוגמה ב-APIs Explorer במסך מלא בלחיצה על סמל הקוד שמתחת לשם של התרחיש לדוגמה. בממשק המשתמש במסך מלא אפשר לעדכן את ערכי הפרמטרים והמאפיינים, ודוגמאות הקוד יתעדכנו באופן דינמי כדי לשקף את הערכים שהזנתם.
לשיטה הזו יש תרחיש נפוץ אחד, שמתואר בהמשך. הלחצנים שמתחת לתיאור מאכלסים ב-APIs Explorer ערכים לדוגמה או פותחים את APIs Explorer במסך מלא כדי להציג דוגמאות קוד שמשתמשות בערכים האלה. דוגמאות הקוד גם מתעדכנות באופן דינמי אם משנים את הערכים.
Use cases | |
---|---|
list (by video ID) | This example retrieves information about a specific video. It uses the id parameter to identify the video. |
list (multiple video IDs) | This example retrieves information about a group of videos. The id parameter value is a comma-separated list of YouTube video IDs. You might issue a request like this to retrieve additional information about the items in a playlist or the results of a search query. |
list (most popular videos) | This example retrieves a list of YouTube's most popular videos. The regionCode parameter identifies the country for which you are retrieving videos. The sample code is set to default to return the most popular videos in the United States. You could also use the videoCategoryId parameter to retrieve the most popular videos in a particular category. |
list (my liked videos) | This example retrieves a list of videos liked by the user authorizing the API request. By setting the rating parameter value to dislike , you could also use this code to retrieve disliked videos. |