Facebook Graph API & ColdFusion: "Param no_story must be a boolean"



我正在尝试使用以下ColdFusion-Code通过Facebook Graph API将图像发布到相册:

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

如果我省略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

我尝试了以下变体:

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

这些都不起作用。

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

<cfset mytruebool = True>

然后:

<cfhttpparam type="formfield" name="no_story" value="#mytruebool#" />

关键区别在于 cfset 分配上没有引号。

相关内容

最新更新