Internal server error from YouTube Analytics API

2019-07-31 19:19发布

问题:

since yesterday we are receiving code 500 errors from the YouTube Analytics API. Nothing has changed in the relevant code since a few months ago, and everything always went smoothly before yesterday.

This is a sample query (but ALL queries to YT Analytics fail):

https://www.googleapis.com/youtube/analytics/v1/reports?ids=channel%3D%3D<channelid>&metrics=views,averageViewDuration,estimatedMinutesWatched,comments,likes,dislikes,shares,subscribersGained,subscribersLost&dimensions=channel&start-date=2016-06-01&end-date=2016-06-30&start-index=1

(with appropriate channelId and Authorization header set). This is what we are getting back:

{
    "code": 500,
    "message": "The remote server returned an error: (500) Internal Server Error.",
    "response": {
        "error": {
            "errors": [{
                    "domain": "global",
                    "reason": "internalError",
                    "message": "Unknown error occurred on the server."
                }
            ],
            "code": 500,
            "message": "Unknown error occurred on the server."
        }
    }
}

Any clues?

回答1:

I got the same problem : "Error 500" for any youtube API called (yt-analytics.readonly).

Here is a workaround for fixing the problem :

  1. Add the following right on your application https://www.googleapis.com/auth/youtube.readonly, even if it's not usefull

  2. re-generate the refresh token

  3. everything is fixed

You can even remove the application and add it again wihtout the youtube.readonly right, it's still working. It's like the API got an update by adding this unusefull right.

I have also tested another workaround with the API Test Console, by adding "Google APIs Explorer" application with the youtube.readonly & yt-analytics.readonly unblock the problem and you dont have any "Error 500" with your own token.

Hope this helps and it's clear enought !



回答2:

It seems it mostly fixed this problem. I think the problem is on YouTube side. We are still waiting until they fix 100%.