Search code examples
c#youtube-apiaccess-token

Using access token - calling the youTube data API C#


It's unclear to me how I can do an API request to retrieve data for the YouTube API.

I used this code (http://zavitax.wordpress.com/2012/12/17/logging-in-with-google-service-account-in-c-jwt/) to get an access token. The next step is: https://developers.google.com/youtube/v3/guides/authentication?hl=en#OAuth2_Calling_a_Google_API. I don't know how to use www.googleapis.com/youtube/v3/video?access_token=ACCESS_TOKEN in my application to retrieve data. How can I use my access token to request data from the API?


Solution

  • The recommendation is to use the Google APIs Client Library for .NET. As the webpage for the client library states, it's still undergoing active development and isn't as far along as the client libraries for some of the other languages. It still should be usable, though.

    There are specific generated classes to use with the YouTube Analytics API and the YouTube Data API v3. You'll need to download those

    Our C# sample code is unfortunately scarce, but there is one example of doing a video search. Hopefully that is enough to get you started.

    To do anything with the Analytics API, and any write operations with the Data API, you'll need to be authenticated with OAuth 2. There's an explanation of how to do that in the client library docs.

    The client library is maintained by a team within Google, but it's not the YouTube API team, so the best way to follow up with the maintainers with any issues you find is to use the public issue tracker.