youtube / api-samples

Code samples for YouTube APIs, including the YouTube Data API, YouTube Analytics API, and YouTube Live Streaming API. The repo contains language-specific directories that contain the samples.
5.45k stars 2.97k forks source link

Youtube LiveBroadcast Insert Error : Required parameter: part #79

Open Muhammadmateen opened 8 years ago

Muhammadmateen commented 8 years ago

when i am creating live broadcast using specified API https://www.googleapis.com/youtube/v3/liveBroadcasts implementing in javascript its giving me an error "Required parameter: part" Here is my source code

`var userData = { part: "snippet,status", snippet: { title:"Ali in innovatoras live streaming", scheduledStartTime:"2016-07-29T20:14:38.448Z" }, status: { privacyStatus:"public" } };

$http.post('https://www.googleapis.com/youtube/v3/liveBroadcasts',userData,{ headers: { 'Content-Type': 'application/json', 'Authorization':'Bearer ya29.CjAvA26IoX4gCooij2R3D4XuIF00yQcef5KDctwDO-h06-ddQzwJb-AHeOthsXNX_bI' } }).then(function (data) { console.log("Data after Request : ",data); },function (error) { console.log("Error after Request : ",error); });`

and i have also tested through postman check the pic below. plz suggest me the solution as early as possible.

Thanks.

error

deryfath commented 7 years ago

can u teach me setting postman for oaut 2.0 youtube API? I use this link, I use request like this:

POST https://www.googleapis.com/youtube/v3/liveStreams?part=snippet%2Ccdn&key={YOUR_API_KEY} { "snippet": { "title": "TEST STREAM 5", "isDefaultStream": true }, "cdn": { "format": "720p", "ingestionType": "rtmp" } }

and get response 200 like this

{

"kind": "youtube#liveStream", "etag": "\"I_8xdZu766_FSaexEaDXTIfEWc0/RM0d1TWtM4ru4wGR-7F2H5sx63Y\"", "id": "qpF-DuKrsA8Nry2KsjTrcg1476262406493039", "snippet": { "publishedAt": "2016-10-12T08:53:26.000Z", "channelId": "UCqpF-DuKrsA8Nry2KsjTrcg", "title": "TEST STREAM 5", "description": "", "isDefaultStream": false }, "cdn": { "format": "720p", "ingestionType": "rtmp", "ingestionInfo": { "streamName": "bsc2-54cu-x3ze-4kat", "ingestionAddress": "rtmp://a.rtmp.youtube.com/live2", "backupIngestionAddress": "rtmp://b.rtmp.youtube.com/live2?backup=1" }, "resolution": "720p", "frameRate": "30fps" } }

I think that request have similar type with liveBroadcast