Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3831

YouTube Data API playlistItems always returns 400

$
0
0

I'm trying to add videos to a playlist the user entered from Node.JS, however, I always get this 400 code error:

{"error":{"code":400,"message":"'snippet'","errors":[            {"message":"'snippet'","domain":"youtube.part","reason":"unexpectedPart","location":"part","locationType":"parameter"            }        ]    }}

Here's the part of the code that adds the video to the playlist:

request.post({    url: 'https://youtube.googleapis.com/youtube/v3/playlistItems?'+ querystring.stringify({        key: google_api    }),    headers: {'Authorization': 'Bearer '+ tokens.access_token,'Accept': 'application/json','Content-Type': 'application/json'    },    json: {"snippet": {"playlistId": storedsessions[state]["yt-playlist"], // looks something like "PLk970BwgU6MkZpRtCnQqO43FHd7g7m_mn""resourceId": {"kind": "youtube#video","videoId": json["items"][0]["id"]["videoId"] // looks something like "aHCtj4UTQgE"            }        }    }})

Also, ignore the fact I'm using a deprecated module, I have to use it for another API I'm using and couldn't find much information on how to move to Axios or another better module (plus, it works perfectly, so I don't mind it); anyways, what can I do?


Viewing all articles
Browse latest Browse all 3831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>