I made a program to post links to my Facebook, through the Facebook Graph API. At first, getting a user access token, and posting the links seemed to work. But to get a long-lived access token, all requests had to be directed through a Facebook app.
So I made the app, and directed my requests through the app, to post links to my wall. But I kept getting “invalid parameter” error. If I posted https://www.facebook.com … it worked. But any other link that I posted did NOT work. After some attempts at debugging, I went to google, and found this answer.
final_link = 'https://www.facebook.com' graph.put_object(id, link=final_link, connection_name="feed", message='check out this link')
And here is the code the DID NOT work:
final_link = 'http://www.htmlformatnews.com?story_id=1123' graph.put_object(id, link=final_link, connection_name="feed", message='check out this link')
After trying every combination of http, https, www, not www, etc, I went to google and found this answer.
If you dont feel like reading it, Ill copy and paste below.
– go to your app panel in facebook
– choose settings then advanced
– at the end of the page you will find Migrations
– set it to off
This worked for me. This setting is a restriction that all links posted by the facebook app, must be from Facebook, or your apps URL. Here’s what the switch on the Migration button says:
Links in stream posts must go to app’s Canvas or Website URL.
If links are from any other source than facebook.com, or yourappdomain.com, Facebook will reject the links. But switching Migration to off, allows links from other domains to be posted, as well.