javascript - Youtube API - Can't add a video to a playlist -
i've had success requests youtube api v3, having problems getting post version work, adding video playlist. i've tried many combinations of things, putting key in query string, access token in either query string or header, json vs. jsonp, still no luck.
i got work fine in api explorer request prints out basic pieces without context code make work, i'm guessing i'm messing in implementation of calling ajax post command. here's i'm doing:
var myaccesstoken = "blahblah"; //from oauth2, works fine other calls $.ajax({ type: "post", url: "https://www.googleapis.com/youtube/v3/playlistitems?part=snippet&access_token=" + myaccesstoken, data: { "snippet": { "playlistid": "plijo1t8cdbpghojrgegmgfmb-vtaus_x9", "resourceid": { "kind": "youtube#video", "videoid": "kmguygy5gvy" }, } }, success: function(data, textstatus, request) { console.log("in success of ajax call, data: ", data); }, datatype: 'jsonp' });
my current error below. not sure if need "filter selected" or if syntax wrong somewhere.
error 400: domain: "youtube.parameter" location: "" locationtype: "parameter" message: "no filter selected." reason: "missingrequiredparameter"
any ideas try?
i believe you're missing part: 'snippet',
before data
resource.
Comments
Post a Comment