Search code examples
facebookfacebook-graph-apifacebook-php-sdk

Facebook Error #100 : A link must be provided if a picture URL is given


I developped months ago a page to automatically post on my 2 Facebook pages. I could post just a message but also add a link and/or a picture. Everything worked like a charm and my latest post was succesfull the 25th of Nov. Today, I try to publish a news with just a picture and I received an error 100# message which says : "A link must be provided if a picture URL is given".

I can't find any explaination nor help on this subject. It seems that Facebook changes its rules concerning the publication of pictures.

Basically here is the error dump :

FacebookApiException Object
(
    [result:protected] => Array
        (
            [error] => Array
                (
                    [message] => (#100) A link must be provided if a picture URL is given.
                    [type] => OAuthException
                    [code] => 100
                    [fbtrace_id] => xxxxxxxxxxxx
                )

        )

    [message:protected] => (#100) A link must be provided if a picture URL is given.
    [string:Exception:private] => 
    [code:protected] => 0
    [file:protected] => /mypathtofacebook/base_facebook.php
    [line:protected] => 1042
    [trace:Exception:private] => Array
        (
            [0] => Array
                (
                    [file] => /mypathtofacebook/base_facebook.php
                    [line] => 747
                    [function] => throwAPIException
                    [class] => BaseFacebook
                    [type] => ->
                    [args] => Array
                        (
                            [0] => Array
                                (
                                    [error] => Array
                                        (
                                            [message] => (#100) A link must be provided if a picture URL is given.
                                            [type] => OAuthException
                                            [code] => 100
                                            [fbtrace_id] => xxxxxxxxxxxxxxxxx
                                        )

                                )

                        )

                )

            [1] => Array
                (
                    [function] => _graph
                    [class] => BaseFacebook
                    [type] => ->
                    [args] => Array
                        (
                            [0] => /mypageid/feed
                            [1] => post
                            [2] => Array
                                (
                                    [access_token] => myaccesstoken
                                    [from] => myAPPid
                                    [message] => blabla
                                    [picture] => http://www......................jpg
                                    [to] => mypageid

The only thing that changed is that I had to change my FB password. So my access_token was no longer valid and I generated a new one. I used the same process to get this new access_token and I can post on Pages. But once again, only text and link, but no picture alone anymore.

Another info: I try to repost the same picture that the one posted the 25th of Nov and I have the error. So it's definitely not an error in the picture URL or in the image itself.

Thanks in advance


Solution

  • https://developers.facebook.com/docs/graph-api/reference/v2.5/page/feed#publish

    Posting a picture requires a link - the picture is actually the "preview image associated with the link". You can also post to the /page-id/photos endpoint if you want to post a picture without a link.