문제

I want to add a video to playlist, and i use this URL:

https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&key=MY_KEY

And this is the Request body:

{
  "snippet": {
    "playlistId": "PLy-aWRoARIeVFnbSzxnfTI2lyTbEC0Nek",
    "resourceId": {
      "videoId": "EHkozMIXZ8w",
      "kind": "youtube#video"
    }
  }
}

And i am getting this error:

"message": "Playlist item id not specified."

Any idea what can be the problem?

도움이 되었습니까?

해결책

I had same problem. The problem was in using PUT method (as in PlaylistItems: update) instead of required POST.

다른 팁

The url and data seems to be fine. I think the problem lies elsewhere. Did you specify sending json data ? ('Content-Type: application/json')

Use insert method

POST https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&key={YOUR_API_KEY}

with body

{
 "snippet": {
  "playlistId": "playlist_id",
  "resourceId": {
   "videoId": "video_id",
   "kind": "youtube#video"
  }
 }
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top