I'm using curl with YouTube API v3 to create a broadcast, modify video title, etc without any issues. My problem is when I try to add a thumbnail to a video using the docs from Google.
Here is my sample with the keys changed for security reasons:
curl --request POST -v \
"https://youtube.googleapis.com/youtube/v3/thumbnails/set\
?videoId=RoZypUhZY04\
&uploadType=media\
&key=mykey" \
--header 'Authorization: Bearer my_access_token' \
--header 'Content-Type: image/jpeg'\
-F 'file=@/Users/adviner/Projects/Prototypes/VendorAPI/source/YouTube/YouTube-BOS.jpg'\
-F 'filename=YouTube-BOS.jpg'
I have tried:
-F 'image=@/Users/adviner/Projects/Prototypes/VendorAPI/source/YouTube/YouTube-BOS.jpg'\
In the documentation it says to use the following URL to POST the image:
https://www.googleapis.com/upload/youtube/v3/thumbnails/set
but when you view the sample it says to use:
https://youtube.googleapis.com/youtube/v3/thumbnails/set
I have tried both and it seems that the images are properly uploaded but I get the following errors:
For the first URL: https://www.googleapis.com/upload/youtube/v3/thumbnails/set
{
"error": {
"code": 400,
"message": "Media type 'image/jpeg; boundary=------------------------136ebfc0c8146cb8' is not supported. ",
"errors": [
{
"message": "Media type 'image/jpeg; boundary=------------------------136ebfc0c8146cb8' is not supported. ",
"domain": "global",
"reason": "badRequest"
}
],
"status": "INVALID_ARGUMENT"
}
}
When using the URL: https://youtube.googleapis.com/youtube/v3/thumbnails/set
{
"error": {
"code": 400,
"message": "The request does not include the image content.",
"errors": [
{
"message": "The request does not include the image content.",
"domain": "youtube.thumbnail",
"reason": "mediaBodyRequired",
"location": "body",
"locationType": "other"
}
]
}
}
Any ideas on what I'm missing?
Thanks