Facebook Graph API和ColdFusion:"Param no_story必须是一个布尔值"

Bor*_*ris 5 coldfusion facebook facebook-graph-api

我试图通过Facebook Graph API将图像发布到相册,并遵循以下ColdFusion-Code:

<cfhttp method="post" url="https://graph.facebook.com/#albumid#/photos/">
    <cfhttpparam type="formfield" name="access_token" value="#access_token#" />
    <cfhttpparam type="file" name="source" file="#img_dir#\dummy.jpg" />
    <cfhttpparam type="formfield" name="message" value="foo bar" />
    <cfhttpparam type="formfield" name="no_story" value="true" />
</cfhttp>
Run Code Online (Sandbox Code Playgroud)

如果我省略no_story=true,整个过程完美无缺,但是我需要这个属性来阻止帖子出现在我的墙上.我收到这个错误:

{"error":{"message":"(#100) Param no_story must be a boolean","type":"OAuthException","code":100}}

HTTP/1.1 400 Bad Request Content-Type: text/javascript; charset=UTF-8 WWW-Authenticate: OAuth "Facebook Platform" "invalid_request" "(#100) Param no_story must be a boolean" Access-Control-Allow-Origin: * X-FB-Rev: 1568945 Pragma: no-cache Cache-Control: no-store Facebook-API-Version: v2.2 Expires: Sat, 01 Jan 2000 00:00:00 GMT X-FB-Debug: Vt7Viz/nlNfsQDDfNKtVuBjfgjDiWPFxYb0TAEpJJa9NjrR+TrEB8nuMOerQJYMX9E2e1CeqfBZT70/1KODErg== Date: Wed, 21 Jan 2015 12:13:31 GMT Connection: close Content-Length: 98
Run Code Online (Sandbox Code Playgroud)

我试过以下变化:

<cfhttpparam type="formfield" name="no_story" value="TRUE" />
<cfhttpparam type="formfield" name="no_story" value="True" />
<cfhttpparam type="formfield" name="no_story" value="#true#" />
<cfhttpparam type="formfield" name="no_story" value="#JavaCast('boolean', true)#" />
<cfhttpparam type="formfield" name="no_story" value="1" />
<cfhttpparam type="formfield" name="no_story" value="Yes" />
Run Code Online (Sandbox Code Playgroud)

这些都没有奏效.

Jac*_* M. -1

很难测试这一点,但我怀疑它可能是传递文本而不是布尔值。也许尝试:

<cfset mytruebool = True>
Run Code Online (Sandbox Code Playgroud)

然后:

<cfhttpparam type="formfield" name="no_story" value="#mytruebool#" />
Run Code Online (Sandbox Code Playgroud)

主要区别是 cfset 分配上没有引号。