## Samples in this directory:
### [Authorize a request](/javascript/auth.js)
Description: The auth.js script demonstrates how to use the Google APIs Client Library for JavaScript
to provide API access and authorize user requests. All of the subsequent samples on this page use this script to
authorize their requests.
For requests that do not require authentication, you could also use the
key query parameter to specify an API key rather than using OAuth 2.0.
Note: You need to update the client ID in the auth.js file. You can obtain your own
client ID by registering your application in the
Google Developers Console.
### [Do resumable uploads with CORS](/javascript/cors_upload.js)
Method: youtube.videos.insert
Description: This code sample demonstrates how to execute a resumable upload using XHR/CORS.
### [Create a playlist](/javascript/playlist_updates.js)
Method: youtube.playlists.insert
Description: This JavaScript code creates a private playlist and adds videos to that playlist. (You could, of course, modify the code so that it creates a publicly visible playlist or so that it checks a form value to determine whether the playlist is
public or private.) Note that you need to update the client ID in the auth.js file to run this code.
The HTML page uses JQuery, along with the auth.js and playlist_updates.js JavaScript files, to display a simple form for adding videos to the playlist.
### [Retrieve my uploads](/javascript/my_uploads.js)
Method: youtube.playlistItems.list
Description: The JavaScript sample code performs the following functions:
channels.list method. This API call also sets the mine parameter to true to retrieve channel information for the authorizing user.playlistItems.list method to retrieve the videos in that list.auth.js and my_uploads.js JavaScript files, and a CSS file to display the list of uploaded videos.
### [Search by keyword](/javascript/search.js)
Method: youtube.search.listsearch.list method to retrieve search results associated
with a particular keyword. The HTML page uses JQuery, along with the auth.js and search.js JavaScript files, to show a simple search form and display the list of search results.
### [Upload a video](/javascript/upload_video.js)
Method: youtube.videos.insertcors_upload.js and upload_video.js JavaScript files, and the
upload_video.css file to upload a video file to YouTube.data-clientid attribute in the code for the Sign-In Button
with your project's client ID. The only valid JavaScript origin for the client ID in the sample code is
http://localhost. This means that you could test the sample locally, but it would not work in your
production application.
### [Calling the Analytics API](/javascript/analytics_codelab.js)
Method: youtubeAnalytics.reports.querywww.google.com/jsapi),
which lets you easily import one or more Google APIs. This example uses the API loader to load the Google Visualization API,
which is used to chart the retrieved Analytics data. Finally, the
Google APIs Client Library for JavaScript
helps you to implement OAuth 2.0 authentication and to call the YouTube Analytics API.