node.js - "Request Entity Too Large" Inserting new YouTube Reference -


i'm trying upload reference video youtube, i've created asset, whenever try inserting reference request entity large error, although file i'm uploading 3.4mb while api documentation states maximum file size 20gb.

any ideas doing wrong?

here's code sample:

fs.readfile(file_path, function(err, data) {     if (!err) {         ytpapi.references.insert({             auth: oauth2client,             onbehalfofcontentowner: contentowner,             resource: {                 assetid: asset_id,                 contenttype: 'video',                 media: {                     mimetype: 'video/mp4',                     body: data.body                 }             }         }, function (err, data) {              if (err) {                 console.log(err);             }              console.log('success');         });     } }); 

i found problem. mistakenly added media object under resource object.

here's correct code sample in case needs it:

fs.readfile(file_path, function(err, data) {     if (!err) {         ytpapi.references.insert({             auth: oauth2client,             onbehalfofcontentowner: contentowner,             resource: {                 assetid: asset_id,                 contenttype: 'video'             },             media: {                 mimetype: 'video/mp4',                 body: data.body             }         }, function (err, data) {              if (err) {                 console.log(err);             }              console.log('success');         });     } }); 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -