we are using Facebook Graph API to implement Facebook sharing from our web application.
We are calling graph API to re-scrape url to be shared using post request as below:
$jq.ajax({
type: 'POST',
url: 'https://graph.facebook.com/?id'+rescrapeUrl,
data : {scrape: true},
success: function(data){
console.log(data);
},
error: function(data) {
console.log(data);
}
});
We received response:
{
"error": {
"code": 1,
"error_subcode": 1357046,
"message": "Received Invalid JSON reply.",
"type": "http"
}
}
Facebook Graph API Response
We tried scraping the same URL using web interface
https://developers.facebook.com/tools/debug/og/object/
and it scraps successfully.
Thank you in advance.
Sometimes below meta-tag creating problem <meta property="og:image:alt" content="some content" /> even if you include it with the other tags including og:image
So, you can try to scrape after removing this og:image:alt tag, then may be scrape working fine.
Related
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.
I'm new in facebook graph API. I easily post upload in FB's pages. But I want to upload in a timeline. But I got an error.
Request :
POST API
https://graph.facebook.com/v3.0/me/photos?access_token=<user_accessToken>&url=https://www.facebook.com/images/fb_icon_325x325.png&caption=Test photo upload
Response :
{
"error": {
"message": "(#200) This endpoint is deprecated since the required permission publish_actions is deprecated",
"type": "OAuthException",
"code": 200,
"fbtrace_id": "A6EzpIcMC9-hZcDlTPA6iPG"
}
}
Please, Explain to me How can I upload a post in the timeline.
Ref., https://developers.facebook.com/docs/graph-api/photo-uploads/
Posting to the user profile is not possible anymore, as the error message tells you. There is no API for it anymore, you can only use the Share Dialog: https://developers.facebook.com/docs/sharing/reference/share-dialog
Changelog with deprecation info: https://developers.facebook.com/docs/graph-api/changelog/breaking-changes#4-24-2018
I'm trying to create a test page for the test user i created in my Facebook application portal, i added the manage_page permission to the test user and aquired an access token as mentioned in the documentation.
However, i'm using the Facebook graph explorer to make a post request to user_id/accounts with the following parameters:
**name** Test Page
**about** This is a test page
**category_enum** LITERARY_ARTS
**picture** https://upload.wikimedia.org/wikipedia/commons/3/36/Hopetoun_falls.jpg
**cover_photo** http://healthhub.co/wp-content/uploads/2014/02/Group-Slider.jpg
i'm getting the following invalid parameter error on the cover picture , i tried to encode the URL but didn't help.
{ "error": {
"message": "(#100) Params cover_photo with a valid URL is required for creating a page",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "A35OXtKL8zh" } }
cover_photo is an object that expects the URL parameter and the URL as value:
{
"url": "<URL VALUE>"
}
I've been banging my head over this for hours now... and can't seem to be able to remove a facebook page tab via api. The access token used has all of the following permissions "offline_access,publish_stream,manage_pages,publish_actions"
I've tried to make a call
https://graph.facebook.com/[page id]/tabs/app_[app_id]?method=delete&access_token=[access token]
the response is
{
"error": {
"message": "(#210) Subject must be a page.",
"type": "OAuthException",
"code": 210
}
}
if i use the the facebook graph explorer
http://developers.facebook.com/tools/explorer
the response is the tab object json... doesn't remove
if i do javascript api call
FB.api(**pageid/tabs/app_1234**, 'delete', {access_token: **My Access tocken**} ,function(response) {
alert(response);
});
the response is (#210) Subject must be a page.
I've read that if you include the full pagid/tabs/tabid then it becomes /paigeid/tabs/pagaid/tabs/tabid so i've tried
FB.api(**app_1234**, 'delete', {access_token: **My Access tocken**} ,function(response) {
alert(response);
});
the response is
(#803) Some of the aliases you requested do not exist: app_XXXXXXXXXXXX
if i use the C# facebook client
fc.Delete( "pageid/tabs/tabid")
the result is again
(#210) Subject must be a page.
The error message seems to be confusing. I have also come across this problem in past.
You are not using the correct access_token. Use access_token for page.
The facebook api shows that you can post a link to an event feed by POST'ing to "EVENT_ID/feed" and only specifying the "link" paramater:
However when doing this the result is:
{ "error": {
"message": "(#100) The message can't be empty when posting to an event's wall",
"type": "OAuthException" }
}
If I specify "message", it will post only the message and not a URL.
How do I post a URL to an event's feed?