I am passing "https://www.cnbc.com/2019/01/13/saudi-energy-minister-on-work-with-oil-producers-to-balance-market.html" as the url to facebook sharing debugger at the following link:
Facebook Sharing Debugger
We can see all the results which facebook has scraped. If we scroll down there and see the entries listed under the URLs section, we see an entry named Scrape API. If we click that it opens the graph api explorer with fields filled automatically.
POST/v3.2/?scrape=true&id=https://www.cnbc.com/2019/01/13/saudi-energy-minister-on-work-with-oil-producers-to-balance-market.html
It was working before but it suddenly stopped working. The error I get is as seen below:
{
"error": {
"message": "Invalid parameter",
"type": "OAuthException",
"code": 100,
"error_subcode": 1611008,
"is_transient": false,
"error_user_title": "Object Missing a Required Value",
"error_user_msg": "Object at URL 'https://www.cnbc.com/2019/01/13/saudi-energy-minister-on-work-with-oil-producers-to-balance-market.html' of type 'article' is invalid because a required property 'al:ios:url' of type 'appsite' was not provided.",
"fbtrace_id": "Gb0BSdJyfGb"
}
}
What i am trying to achieve here is to get the data which facebook scrapes from the url given to the debugger.
EDIT 1:
If you use the following url as test and do the post request as described above. It works and the result is as follows:
Test URL: https://www.bloomberg.com/news/articles/2019-01-13/asian-stocks-to-start-mixed-with-earnings-in-focus-markets-wrap?srnd=premium
RESULT:
{
"url": "https://www.bloomberg.com/news/articles/2019-01-13/asian-stocks-to-start-mixed-with-earnings-in-focus-markets-wrap",
"type": "article",
"title": "Stocks Fall, Bonds Rise as China and Banks Weigh: Markets Wrap",
"image": [
{
"url": "https://assets.bwbx.io/images/users/iqjWHBFdfxIU/iZv8.HNBZJtU/v0/1200x674.jpg"
}
],
"description": "U.S. stocks declined and Treasuries rose as weak Chinese trade data and troubling signals in bank earnings weighed on investor confidence. The dollar edged lower.",
"site_name": "Bloomberg.com",
"updated_time": "2019-01-14T14:38:37+0000",
"id": "2214485868588392"
}
Can someone shed some light as why other urls are not working though they work in the debugger?
Related
I'm trying to use the Graph api to create pages. So I have an application type Entreprise, and a Test User. I tried this:
Post request to [userTest_id]/accounts/
Params:
{
"name": "Test Page One",
"about": "This is the first page created to check the api",
"cover_photo": {
"url": "https://i.etsystatic.com/6293506/r/il/ea9cf8/1809124703/il_fullxfull.1809124703_swn3.jpg"
},
"picture": "https://i.etsystatic.com/6293506/r/il/ea9cf8/1809124703/il_fullxfull.1809124703_swn3.jpg",
"category_list": "[\"174177802634376\"]"
}
I use user token
I get this error:
{
"error": {
"message": "Unsupported post request. Object with ID '[userTest_id]' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api",
"type": "GraphMethodException",
"code": 100,
"error_subcode": 33,
"fbtrace_id": "ATSiLLBx2O1yOuPRFxq4r4V"
}
}
I've followed this doc:
https://developers.facebook.com/docs/graph-api/reference/user/accounts/#Creating
What I'm missing plz ?
Thanks.
Facebook API doesn't allow creating Pages in the "real world" scope. You may do it for test users (created on the Role tab) or, in production, you have to get special approval from Facebook (not just permission).
I am using "WhatsApp Business On-Premises API" for submitting templates. When something is wrong with template i.e. formatting whatsapp throws exception in this format
{
"error": {
"code": 100,
"type": "OAuthException",
"message": "Invalid parameter",
"fbtrace_id": <id>,
"is_transient": false,
"error_subcode": 2388047,
"error_user_msg": "Message body can't have more than two consecutive newline characters.",
"error_user_title": "Message body format is Incorrect"
}
}
i want documentation for all the error_subcodes so that i can translate them and show bases on the language for the user who is submitting the template.
PS: i have seen https://developers.facebook.com/docs/whatsapp/on-premises/errors#error but doesn't give all the error_subcodes fall under code 100.
i've also posted over community but couldn't get help there https://developers.facebook.com/community/threads/367295468710196/?post_id=367295472043529
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.
I have 2 facebook pages where im admin on, lets call them page_a and page_b
if i run this for page_a it works as expected:
HTTP GET -> {PAGE_A_ID}/insights?metric=page_fans_country
{
"data": [
{
"name": "page_fans_country",
"period": "day",
"values": [
{
"value": {
"AR": 4,
"AT": 13,
"AU": 7,
"BE": 16,
....
the page access token i use have the following scopes: read_insights, manage_pages, pages_show_list and public_profile
but when i then try to query details about a post i get this
HTTP GET -> {PAGE_A_ID}_{PAGE_A_POSTID}/insights?metric=post_impressions,post_impressions_unique,post_video_views,post_video_views_unique&period=lifetime
{
"error": {
"message": "Permissions error",
"type": "OAuthException",
"code": 200,
"error_subcode": 1504029,
"is_transient": false,
"error_user_title": "User doesn't have enough permissions to load insights",
"error_user_msg": "You do not have enough permission to view the metric.",
"fbtrace_id": "..."
}
}
it works when i do the same for page_b
HTTP GET -> {PAGE_B_ID}_{PAGE_B_POSTID}/insights?metric=post_impressions,post_impressions_unique,post_video_views,post_video_views_unique&period=lifetime
{
"data": [
{
"name": "post_video_views",
"period": "lifetime",
"values": [
{
"value": 0
}
],
....
the page access token for page_b has same scopes as the one for page_a
I can see all the numbers in facebooks UI, but i cant not access it via the API, anybody had similar issues before?, im stuck and dont know where to go from here.
All above code have been ran in the Facebook Graph Explore, with newly generated tokens.
Any inputs on where to go from here are appreciated.
As mentioned in a comment by #xuantuan58 this seems to be a bug in the FB API.
https://developers.facebook.com/support/bugs/301627877187448/
And may also be related to this bug report: https://developers.facebook.com/support/bugs/2380273985356980/
I have noticed it is only occurring on certain users & pages but as of yet am unable to see a pattern. Sometimes an error will not be returned by the API and instead just an empty data array. If you think there should be data in the response try using the graph explorer tool as I've found that will sometimes give better error responses.
https://developers.facebook.com/tools/explorer/
UPDATE: This issue has now been marked as resolved by Facebook. I have been testing and found this issue has indeed been fixed.
We got the same issue a couples day ago. After playing with scopes we found that if business_management scope is grant then we got the data. But clearly, from its document business_management is not required for reading Page Insights. Hopefully, there is someone has better insights
My app needs to get data facebook scrapes from URLs. Up until now we were getting it using
POST /?id={object-instance-id or object-url}&scrape=true
Which is detailed in updating object section in https://developers.facebook.com/docs/sharing/opengraph/using-objects
For example
POST /?id=http://google.com
{
"url": "http://www.google.com/",
"type": "website",
"title": "Google",
"image": [
{
"url": "http://www.google.com/images/branding/googleg/1x/googleg_standard_color_128dp.png"
}
],
"description": "Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.",
"updated_time": "2015-10-06T11:34:58+0000",
"id": "381702034999"
}
Notice image section.
Unfortunately if og tags are configured wrongly on the server
POST /?id=http://some.page.with.bad.tags.com
{
"error": {
"message": "Invalid parameter",
"type": "FacebookApiException",
"code": 100,
"error_subcode": 1611016,
"is_transient": false,
"error_user_title": "Object Invalid Value",
"error_user_msg": "Object at URL 'http://some.page.with.bad.tags' of type '' is invalid because the given value '/some-bad-value' for property 'og:url' could not be parsed as type 'url'.",
"fbtrace_id": "abcabcabc"
}
}
Which returns nothing interesting.
Attempt to GET the url returns this:
{
"og_object": {
"id": "381702034999",
"description": "Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.",
"title": "Google",
"type": "website",
"updated_time": "2015-10-06T11:40:04+0000",
"url": "http://www.google.com/"
},
"share": {
"comment_count": 2,
"share_count": 13494003
},
"id": "http://www.google.com"
}
Which misses image section. I cannot find in the documentation any way to retrieve result with images without using POST /?id={url}, but that fails on any errors in og tags.
GET /{ObjectId}
returns only type and created_time
Entering the same broken link in https://developers.facebook.com/tools/debug/ results in page which contains image, description, title and captions for the page. Which I need. So it means facebook stores them, even though page has wrong tags, but I need a way to fetch them. Unfortunatelly I cannot provide link for broken url due to NDA, and I couldn't find other page with broken tags.
If the page contains invalid Open Graph markup this seems expected, also do not confuse the Graph API with some sort of datasource or a scraping service you can utilize to generate the preview for web content.
If Facebook , for whatever reason, can't parse the Open Graph tags of a URL it will try to make a good guess based on the content of the page (large junks of text, images it finds, title tags etc.) to build the preview so you might get some sort of data back from GET /{object-id} which can just be a guess instead of actual og:.. data.
In case you really need a more or less failsafe solution, you could build your own scraper that looks for Open Graph tags.