0

As you know there is a nearest API update for YouTube Analytics for version two and I just wanted to try it. There is a constructor of your request like a: https://developers.google.com/apis-explorer/#p/youtubeAnalytics/v2/youtubeAnalytics.reports.query

so when you fill up some fields and click on authorize and execute you will see a special formed link like a https://youtubeanalytics.googleapis.com/v2/reports?dimensions=insightTrafficSourceType%2Cday&endDate=2018-09-19&ids=.........&key={YOUR_API_KEY}. So I can't understand which API key I need to use. Can you help me and provide a correct instruction and link to information about my issue?

Thanks and have a nice day

1 Answers1

0

The YouTube Analytics API uses the OAuth 2 protocol to authenticate. Basically in order to make requests you'll have to authenticate with your YouTube account. When you do so, YouTube will send back a key to the API. As mentioned in this page of the documentation you will then either be able to use this token to access the API, or you'll exchange it for another token which can be used to access the API.

OAuth 2 is somewhat involved, but you can read this article (or many others) for more about it: https://developers.google.com/youtube/reporting/guides/authorization

Henry Woody
  • 14,024
  • 7
  • 39
  • 56
  • So as I understand I can't get JSON response via browser ? – Evan Fobinsky Sep 19 '18 at 09:16
  • I believe you can get a JSON response via the browser. In OAuth2, YouTube's server will send you information by redirecting the user to a Redirect URI that you provide to YouTube when you register your app with them. The uri will contain information for you to take. Basically the url will be something like `mysite.com/oauth/login?token=xxxxx` then your app can grab the token from the uri. Once you have the token you can make all the requests you want. – Henry Woody Sep 19 '18 at 09:24