Coldfusion Youtube API上传Cfhttp Snippet

时间:2014-05-02 20:25:10

标签: coldfusion youtube-api google-oauth

我正在尝试使用Youtube API上传视频到目前为止这么好,但是当我尝试使用cfhttp传递代码段和状态以启动可恢复的上传时虽然我得到200 ok响应但似乎没有片段参数作为结果视频没有合适的标题......

<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>

有没有人有任何想法?

2 个答案:

答案 0 :(得分:1)

在这一行“<cfhttpparam type="header" value="Bearer #form.rectoken#" name="Authorization">”什么是直接?

答案 1 :(得分:0)

刚刚取代Jsondet ......就像那个傻了......

<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"
  }
}>