Facebook API issue when deleting some comments - facebook

Whenever I try to delete a comment made to a Wall post originating from FB I get the following error:
{
"error": {
"message": "(#1705) Selected wall post for deletion does not exist.",
"type": "OAuthException",
"code": 1705
}
}
Now this doesn't make any sense since the comment has can_remove attribute set to true, and I can delete any comment made to a post by the app, only the comment to a post which was posted in FB isn't deletable. Any ideas?

Related

Facebook graph api page post with multiple photos

I am trying to publish a page post with multiple photos via the Facebook's graph api.
Currently from the docs and another question here it's stated that the photos should be uploaded separately and then publish the post with attached_media parameter.
The photos are uploaded fine without any problem and I get their IDs.
The issue is that the request for publishing the post gives:
{
"error": {
"message": "An unknown error has occurred.",
"type": "OAuthException",
"code": 1,
"fbtrace_id": "SOME TRACE ID"
}
If I remove the attached_media parameter from the request the post is published fine.. Any Idea what can be the issue?
Specially for CBroe here are the reqiests:
For the photo upload:
endpoint: /{page-id}/photos
payload:
{
"url": "some-image-url",
"caption": "Some image caption",
"published": false
}
endpoint: /{page-id}/feed
payload:
{
"message": "Some post message",
"published": false,
"attached_media": [
{"media_fbid": "PHOTO_ID_RETURNED_FROM_THE_ABOVE_REQUEST"}
]
}
The payload is send as json to the endpoint. This request works only if I remove the attached_media parameter.
TL;DR
Add publish_to_groups permission to the access token and the request for the post should be with parameter published: true. It appears to have a bug in the graph api or lack of information in the official docs.
Details:
Currently in order to publish a page post with multiple photos you will need to:
upload individually the photos and obtain their IDs
use PAGE access token which contains publish_to_groups permission
attach all photo IDs with attached_media[0..N]: {"media_fbid": "PHOTO_ID"}
currently the request for publishing the post fails if it's with parameter published: false, so it needs to be published: true
All of this does not make really sense to me, so I opened a bug report in the developers platform of Facebook. It does not looks right during development of the App to publish live posts to the page...
I'll edit the answer once I have a feedback.

Custom Internal Facebook App Graph API not returning Page's Post Comments

I am trying to create a Facebook app that can pull down the comments on the posts of a business page I have created. I have successfully created the app and connected my Facebook page through OAuth. However, none of the comments on the page's posts are coming through. Any help would be appreciated, please see below code.
https://graph.facebook.com/v3.2/{pageId}/?access_token={accessToken}&fields=id,name,posts
Response:
{
"id": "{pageId}",
"name": "Page Name",
"posts": {
"data": [
{
"created_time": "2016-01-15T19:46:28+0000",
"message": "POST 1",
"id": "47829695884833182_111061999222282539"
},
{
"created_time": "2016-01-15T19:45:56+0000",
"message": "POST 2",
"id": "4734458296958848182_111061922795615892"
}
}
}
The same thing happens if I use the following endpoint:
https://graph.facebook.com/v3.2/{pageId}/feed?access_token={accessToken}
Or
https://graph.facebook.com/v3.2/{pageId}/posts?access_token={accessToken}
I found a reference showing I may be able to get comments through this endpoint:
https://graph.facebook.com/v3.2/{pageId}/comments?access_token={accessToken}
However I get the following response:
{
"error": {
"message": "(#100) Tried accessing nonexisting field (comments) on node type (Page)",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "EN938TNAHM6"
}
}
With all but the last request you are not asking for comments anywhere. And with the last one you are trying to ask for comments on the page object itself, which are not a thing.
You need to ask for the comments, on either the feed or posts endpoint:
/{pageId}/feed?fields=comments
/{pageId}/posts?fields=comments
And if you want to get other info about the page as well in the same request, you can use Field Expansion syntax,
/{pageId}?fields=id,name,posts{comments}
(Any other fields of the posts you might want besides the default id, you’d need to list there comma separated - posts{message,comments,...})
I was able to get comments by using the following request:
https://graph.facebook.com/{post_id}/comments?access_token={accessToken}&summary=true
post_id looks something like this - 57042555475_57045425233226
You have to get comments by posts not pages so first you need to make a call to get all your posts and then make a call for each post to get comments.

Commenting on posts Facebook graph api V2.10

Is it possible to comment on any post using the id of the post ? I tried with the V2.9 and the comment is successful but when I tried it with V2.10 it shows me the following error
{
"error": {
"message": "(#3) Publishing comments through the API is only available for page access tokens",
"type": "OAuthException",
"code": 3,
"fbtrace_id": "B7DlJt0HMOL"
}
}
This is what I did in the Graph api Explorer
When I switch the version to V2.9 the comment in the post is successful. Why does this happen or how can I fix it?
The error message tells you what the issue is, commenting on everything else than Page posts is deprecated since v2.10 and will not work anymore:
90-Day Breaking Changes
POST and DELETE /{comment-id} — This node now requires a valid page access token.
For more information, take a look at the changelog: https://developers.facebook.com/docs/graph-api/changelog/version2.10

Facebook Graph API Explorer: posting link doesn't work

When I'm trying to post a link via Graph API Explorer, I get the following response:
{
"error": {
"message": "Unsupported post request.",
"type": "GraphMethodException",
"code": 100
}
}
But when I visit the page, the link seems to be posted
Does anyone know what the problem is?

Facebook: Is it possible to DELETE a Checkin via Graph API?

When I post a checkin to Facebook the API returns the id of the story created.
How can I delete this story?
I tried to delete using
DELETE -> /me/ID
or
DELETE -> /ID
without success.
I received the response GraphMethodException: Unsupported delete request.
You're right, it doesn't work for me either:
{
"error": {
"message": "Unsupported delete request.",
"type": "GraphMethodException",
"code": 100
}
}
But, as Lix quoted:
NOTE: Publishing a Checkin object is deprecated in favor of creating a Post with a location attached.
From https://developers.facebook.com/docs/reference/api/checkin/
It means that Checkin should not be used anymore. Instead, you have to create a Post.
You can create a post on behalf of the user by issuing an HTTP POST
request to PROFILE_ID/feed (not PROFILE_ID/posts)
Creating a post with a location:
Result:
{
"id": "1022369832_4517701013579"
}
Deleting the post with a location:
DELETE -> http://graph.facebook.com/1022369832_4517701013579
Result: true
I think that you haven't any other choice.