RestClient::BadRequest (400 Bad Request): while posting. #55

Closed
rtdp opened this Issue Sep 14, 2011 · 1 comment

Projects

None yet

2 participants

@rtdp
rtdp commented Sep 14, 2011

I was using the code like as follows -

def broadcast_on_facebook(donation)
client = FBGraph::Client.new(:client_id => facebook_account.uid ,:token => facebook_account.access_token)
u = client.selection.me.info!
client.selection.user(u[:id]).feed.publish!(
:message => "I donated for #{donation.cause.name} on mySite. Feels good and satisfied to be helpful to somebody in need.",
:name => "Donate Now !!",
:link => "#{RETURN_URL_LOCALHOST}?uuid=#{uuid}",
:picture => 'https://mysite.net/images/modules/header/logov3-hover.png',
:caption => donation.cause.description
)
donation.update_attributes(:broadcasted => true)
end

@rtdp
rtdp commented Dec 20, 2011

This code used to give me RestClient::BadRequest error sometimes. And this behavior was very random. It took me long to debug that issue which was with :caption part here. As sometimes, values for :caption was more than 255 characters and so request was failing. It took some time to figure out and change above code to use :description rather than :caption.
Just posting here so somebody may find helpful, also can fbgraph has something to reflect errors little better way?

@nsanta nsanta closed this Jan 12, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment