הרשימה הבאה מציגה תרחישים לדוגמה נפוצים לשימוש בשיטה זו. מעבירים את העכבר מעל תרחיש לדוגמה כדי לראות את התיאור שלו, או לוחצים על תרחיש לדוגמה כדי לטעון ערכי פרמטרים לדוגמה ב-API Explorer. אתם יכולים לפתוח את APIs Explorer במסך מלא כדי לראות דוגמאות קוד שמתעדכנות באופן דינמי כדי לשקף את ערכי הפרמטרים שהוזנו ב-Explorer.
הטבלה הבאה מציגה תרחישים לדוגמה נפוצים לשימוש בשיטה הזו. אפשר ללחוץ על שם של תרחיש לדוגמה כדי לטעון ערכי פרמטרים לדוגמה ב-API Explorer. לחלופין, אפשר לראות דוגמאות קוד לתרחיש לדוגמה ב-APIs Explorer במסך מלא בלחיצה על סמל הקוד שמתחת לשם של התרחיש לדוגמה. בממשק המשתמש במסך מלא אפשר לעדכן את ערכי הפרמטרים והמאפיינים, ודוגמאות הקוד יתעדכנו באופן דינמי כדי לשקף את הערכים שהזנתם.
לשיטה הזו יש תרחיש נפוץ אחד, שמתואר בהמשך. הלחצנים שמתחת לתיאור מאכלסים ב-APIs Explorer ערכים לדוגמה או פותחים את APIs Explorer במסך מלא כדי להציג דוגמאות קוד שמשתמשות בערכים האלה. דוגמאות הקוד גם מתעדכנות באופן דינמי אם משנים את הערכים.
Use cases | |
---|---|
list (by keyword) | This example retrieves the first 25 search results associated with the keyword surfing. By default, the type parameter does not specify a value, which means the response could include videos, playlists, and channels. |
list (by location) | This example retrieves search results associated with the keyword surfing that also specify in their metadata a geographic location within 10 miles of the point identified by the location parameter value. (The sample request specifies a point on the North Shore of Oahu, Hawaii . The request retrieves the top five results, which is the default number returned when the maxResults parameter is not specified. |
list (live events) | This example retrieves a list of active live broadcasts (see the eventType parameter value) that are associated with the keyword news. Since the eventType parameter is set, the request must also set the type parameter value to video . |
list (my videos) | This example searches within the authorized user's videos for videos that match the keyword fun. The forMine parameter indicates that the response should only search within the authorized user's videos. Also, since this request uses the forMine parameter, it must also set the type parameter value to video .If you have not uploaded any videos associated with that term, you will not see any items in the API response list. |