Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3831

Thumbnail upload YouTube API v3 failing

$
0
0

The YouTube API v3 is horribly documented. I've already reported numerous bugs multiple times but no one reacts.I still have to use this API to upload thumbnails.The guide states:

POST https://www.googleapis.com/youtube/v3/thumbnails/set

Auth scopes:

Parameters:

  • videoId: string The videoId parameter specifies a YouTube video ID for which the custom video thumbnail is being provided.

First of all - the url is wrong. It has to be https://www.googleapis.com/upload/youtube/v3/thumbnails/set.Now following code, it uses Unirest:

final HttpResponse<String> response = Unirest.post("https://www.googleapis.com/upload/youtube/v3/thumbnails/set")                    .header("Content-Type", "application/octet-stream")                    .header("Authorization", accountService.getAuthentication(account).getHeader())                    .field("videoId", videoid)                    .field("thumbnail", thumbnail)                    .asString();

The received response:

{"error": {"errors": [   {"domain": "global","reason": "required","message": "Required parameter: videoId","locationType": "parameter","location": "videoId"   }  ],"code": 400,"message": "Required parameter: videoId" }}

How can this be? The videoId is set!Anyone already played with this part of the API?

I can change the request to

Unirest.post("https://www.googleapis.com/upload/youtube/v3/thumbnails/set?videoId=" + videoid)                    .header("Content-Type", "application/octet-stream")                    .header("Authorization", accountService.getAuthentication(account).getHeader())                    .field("mediaUpload", thumbnail)                    .asString();

This will throw me this error:

{"error": {"errors": [   {"domain": "global","reason": "backendError","message": "Backend Error"   }  ],"code": 503,"message": "Backend Error" }}

Edit:Same request with URL posted by Ibrahim Ulukaya (the original url from the reference guide):

{"error": {"errors": [   {"domain": "global","reason": "wrongUrlForUpload","message": "Uploads must be sent to the upload URL. Re-send this request to https://www.googleapis.com/upload/youtube/v3/thumbnails/set"   }  ],"code": 400,"message": "Uploads must be sent to the upload URL. Re-send this request to https://www.googleapis.com/upload/youtube/v3/thumbnails/set" }}

Viewing all articles
Browse latest Browse all 3831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>