Question

I am trying to upload a video using Youtube API so far so good but when i try to pass snippet and status with cfhttp in order to start a resumable upload although i get a 200 ok respond it seems that there none snippet parameter as a result the video does not have the appropriate title...

<cfset jsondet='{
  "snippet": {
    "title": "My video title",
    "description": "This is a description of my video",
    "tags": ["cool", "video", "more keywords"],
    "categoryId": 22
  },
  "status": {
    "privacyStatus": "private",
    "embeddable": True,
    "license": "youtube"
  }
}'>
<cfhttp method="Post" url="https://www.googleapis.com/upload/youtube/v3/videos?uploadType=resumable&part=snippet,status" >
      <cfhttpparam type="header" value="Bearer #form.rectoken#" name="Authorization">
      <cfhttpparam type="header" value="278" name="Content-Length">
      <cfhttpparam type="header" value="application/json; charset=UTF-8" name="Content-Type">
      <cfhttpparam type="header" value="3000000" name="X-Upload-Content-Length">
      <cfhttpparam type="header" value="video/*" name="X-Upload-Content-Type">  
      <cfhttpparam type="body"   value="#serializeJSON(jsondet)#">

  </cfhttp>

Does anyone have any freaking idea?

Was it helpful?

Solution 2

Just Replace Jsondet.... As silly as that...

<cfset jsondet={
 "snippet"= {
 "title"= "My video title",
 "description"= "This is a description of my video",
 "tags"= ["cool", "video", "more keywords"],
 "categoryId"= 22
},
  "status"= {
  "privacyStatus"= "private",
  "embeddable"= True,
  "license"= "youtube"
  }
}>

OTHER TIPS

On this line " <cfhttpparam type="header" value="Bearer #form.rectoken#" name="Authorization">" what is rectoken?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top