I am struggling while trying to upload programmatically Youtube captions, following the official documentation: https://developers.google.com/youtube/v3/docs/captions/insert.
I tried many things with postman:1/ pass the snippet in the body: caption file is missing
2/ use form-data and try to add both the file and the snippet data: data are not found.(I tried multiple ways to try to pass the snippet info together with the caption file. ex: snippet.language, snippet["language"], snippet and pass a stringified json...)
Example of request Using Raw Json
curl --location 'https://www.googleapis.com/youtube/v3/captions/' \--header 'Content-Type: application/json' \--header 'Authorization: Bearer xxx.yyy.zzz' \--data '{"snippet": {"language": "fr","name": "Spanish captions","videoId": "flz-udcavwE","isDraft": false }}
Example of request using FormData
curl --location 'https://www.googleapis.com/youtube/v3/captions/?part=snippet' \--header 'Authorization: Bearer xxx.yyy.zzz' \--form 'caption=@"tnGz3GV3E/captions.sbv"' \--form 'snippet="{\"snippet\":{\"language\":\"fr\",\"name\":\"fr\"&\"videoId\":\"flz-udcavwE\"}}"
Please help to construct properly that call!