5
votes

I'm trying to post an image to an album via the Facebook Graph API with following 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>

If I omit no_story=true, the whole thing works perfectly, however I need this attribute to prevent the post from appearing on my wall. I'm getting this error:

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

I have tried following variations:

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

None of these worked.

1
Can you show your post request body, As in what the browser shows what data it is actually posting. Use dev tools in the browser to find it. - haxtbh
@haxtbh Unfortunately this is happening server-side. I'm trying to find a way to see what data is posted. - Boris
Check the current status here: developers.facebook.com/bugs/855430617846913 - Boris
@Boris - In case the link breaks, can you post a brief summary of what it says? - Leigh
Yep, will do. Currently still working on it. - Boris

1 Answers

-1
votes

Difficult to test that out, but I suspect maybe it is passing the text as opposed to the boolean value. Maybe try:

<cfset mytruebool = True>

Then:

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

The key difference being no quotes on the cfset assignment.