Search code examples
phpfacebook-graph-apifacebook-events

Can I post event photos to Facebook event by website or mobileApp using graph-api 2.7?


After I read this https://developers.facebook.com/docs/graph-api/reference/event/photos/#Creating I'm not sure that POST request is Upload photo to event or just upload url photo (param "url" in the table) or else ? I try to find any example but still can't find any of it.


Solution

  • As it says there in the description of the url field,

    The URL of a photo that is already uploaded to the Internet. You must specify this or a file attachment

    The second part means, you can also upload a file (instead of providing a URL). The parameter name for uploads historically has been source – but you can use basically any name, the API doesn’t care. (If you post to a /photos endpoint and the data contains a file upload, then the API will use that, no matter what it is named.)

    You can follow this example, https://developers.facebook.com/docs/php/howto/example_upload_photo – that is for an upload to a user profile, but it works the same way for events etc.