0

I am using curl/postman tested. Can post video to youtube server, but snippet data ignored always, frustrating, thanks in advance.

curl

$ curl -X POST --proxy 127.0.0.1:8118 \
-H "Authorization: token_here" \
-H "Content-Type: multipart/form-data" \
-F "''={'snippet':{'title' : 'TITLE_TEXT', 'description': 'DESCRIPTION_TEXT'}}" \
-F "''=@file_to_upload" \
https://www.googleapis.com/upload/youtube/v3/videos\?part\=snippet

response

{
    "kind": "youtube#video",
    "etag": "\"sZ5p5Mo8dPpfIzLYQBF8QIQJym0/csORsfSKaIS5MEMheYZalF19JVo\"",  "id": "7EjBVtJSlSw",
    "snippet": {
        "publishedAt": "2016-11-02T16:19:02.000Z",
        "channelId": "UC4n-MgxCL1zk7Cb3wayjRTA",
        "title": "unknown",
        "description": "",                                                                                                    "thumbnails": {
            "default": {                                                                                                              "url": "https://i.ytimg.com/vi/7EjBVtJSlSw/default.jpg",
                "width": 120,                                                                                                         "height": 90
            },                                                                                                                    "medium": {
                "url": "https://i.ytimg.com/vi/7EjBVtJSlSw/mqdefault.jpg",
                "width": 320,
                "height": 180
            },
            "high": {
                "url": "https://i.ytimg.com/vi/7EjBVtJSlSw/hqdefault.jpg",
                "width": 480,
                "height": 360
            }
        },
        "channelTitle": "Chengyuan Luo",
        "categoryId": "22",
        "liveBroadcastContent": "none",
        "localized": { "title": "unknown",    "description": ""   }
    }
}
Roger
  • 973
  • 10
  • 15
  • I would suggest that you use the client libraries as also suggested in a [related question](http://stackoverflow.com/a/13277596/5995040). This will make requesting or doing any interaction with the API easier. But if you would still have to use curl, you might want to read about this [YouTube API v3 over HTTP POST](http://stackoverflow.com/a/36213106/5995040) which get this to work by making 2 API calls - one to upload the video and getting the resulting ID, and a second to update the video by that ID. – Mr.Rebot Nov 03 '16 at 14:43
  • thanks, I have used the same solution as you suggest. But I am still wondering if this can be accomplished in 1 http request. – Roger Nov 03 '16 at 14:46

0 Answers0