IT WORKS IF I COMMENT OUT THE source VARIABLE AND USE picture VARIABLE INSTEAD
BUT I HAVE TO PICK FROM THE TemporaryDirectory FOLDER
I have seen the use of type=“photo” as the last arg in the source variable and the facebook.request could maybe be “me/photo” or some other value but then again it wouldn´t be a feed on the users wall i guess…
I have red all I could find on dev facebook API pages, but I cant find the solution.
You cannot make up arbitrary things to pass to a REST API. Facebook has a well defined set of arguments that it expects on a POST request to the me/feed object. They are documented here:
Now that API call takes a source parameter that is a multipoart/form-data type and your source might work for that. I’ve never done it, but hopefully in the response from uploading the photo, you would get it’s Facebook ID that you could then use in #2 for the me/feed action.
I finally made it late yesterday night after some hours of testing and failing I experienced all you described, the funny thing is that this worked on my earlier code with me/feed and source = and fetching from my temp folder. I beleve this has changed in the FB API, you agree?
the solution was, for me, to first do a login check and when event.phase was “login” I used:
[lua] facebook.request( “me” )[/lua]
And for the second chunk:
[lua]
local attachment =
{
message = “Your image is now on your Facebook page!”,
source = { baseDir=system.TemporaryDirectory, filename=“imageForFb.jpg”, type=“image” },
}
facebook.request( “me/photos”, “POST”, attachment ) – posting the photo
end
You cannot make up arbitrary things to pass to a REST API. Facebook has a well defined set of arguments that it expects on a POST request to the me/feed object. They are documented here:
Now that API call takes a source parameter that is a multipoart/form-data type and your source might work for that. I’ve never done it, but hopefully in the response from uploading the photo, you would get it’s Facebook ID that you could then use in #2 for the me/feed action.
I finally made it late yesterday night after some hours of testing and failing I experienced all you described, the funny thing is that this worked on my earlier code with me/feed and source = and fetching from my temp folder. I beleve this has changed in the FB API, you agree?
the solution was, for me, to first do a login check and when event.phase was “login” I used:
[lua] facebook.request( “me” )[/lua]
And for the second chunk:
[lua]
local attachment =
{
message = “Your image is now on your Facebook page!”,
source = { baseDir=system.TemporaryDirectory, filename=“imageForFb.jpg”, type=“image” },
}
facebook.request( “me/photos”, “POST”, attachment ) – posting the photo
end