Reputation: 1097
I'm trying to post a text with image to facebook wall using graph api.
I'm using following code snippet for this.
var body = {
message : 'this is a test message',
image : 'http://someurltoimage.png'
};
FB.api(
"/me/feed",
"POST",
{
"object": {
"message": body.message,
"picture": body.image
}
},
function (response) {
if (response && !response.error) {
//process when success
}
}
);
But I'm getting following error code.
error: Object
code: 100
error_subcode: 1349125
message: "Invalid parameter"
type: "FacebookApiException"
There's no document for this error.
Any advise will be appreciated.
Upvotes: 0
Views: 4947
Reputation: 11297
"I'm trying to post a text with image to facebook wall using graph api."
/feed
, to upload a photo you have to use /photos
callobject
which contains your parameters, to Facebook, the API doesn't know that your parameter Object
is an object
(I know, too many object
s here, in another way, you're sending an object within an objectTo solve all this, replace me/feed
with me/photos
and the 3rd argument (your object) with the body
var body = {
message : 'this is a test message',
url: 'http://someurltoimage.png'
};
FB.api("/me/photos",
"POST",
body,
function (response) {
if (response && !response.error) {
//process when success
}
}
);
Upvotes: 3