design for not returning everything in `GET /posts` - rest

I'm making a personal blog with API + SPA.
API should be RESTful and SPA is angular.
For admin's panel posts table or landing page (with api GET /posts), I don't want to include post content, It just increase size of data transfer. also GET /posts response needs id in each item but other APIs don't need them because it is in URL (POST /posts/{{id}}, PUT /posts/{{id}}, GET /posts/{{id}})
What is correct design for it?

Related

Crawl Public Facebook Posts

I made a website where people can post links for other websites and then the backend generates a preview of the link (by using curl and parsing out the open graph tags available on most websites / by picking the first image, html title etc). Now, fine after some tweaking but sometimes I get some kind of rate limit.
Here is one example of a link I want to parse: https://www.facebook.com/HBR/posts/10157131816732787
I can parse it 4 ou 5 times and get a title, image etc but then if I repeat it I get sent to the login page of facebook. How can I avoid this?
I tried to parse the link at https://developers.facebook.com/tools/debug/sharing however it says "Facebook URLs cannot be crawled". So my question is: how am I even supposed to parse those links if they don't even allow it on their debugger?
Is there any kind of API that allows me to get this information without user login? I don't want to parse entire facebook pages, profiles etc, just get a preview for a link that my users might post on the website.
You MUST use the Facebook Graph API if you want to get data of Facebook Pages (or anything else on Facebook), scraping is not allowed.
In order to get data of Pages you do not own, you need to apply for Page Public Content Access: https://developers.facebook.com/docs/apps/review/feature/#reference-PAGES_ACCESS
An App Access Token (without Login) is sufficient in that case.
API Reference for Pages: https://developers.facebook.com/docs/graph-api/reference/page/
I dont think show.You can crawl post on public group using python selenium and beautiful soup

Facebook API replaces part of URL

I am querying facebook posts of a specific fb-page and reading the posts to view them on a website. In a new post they've just created, there's a URL that links to an external page. Normally, facebooks API delivers this link just as is.
But this time, it replaces a part of that URL with a random(?) number. The link that's in the post is: www.roboterwelt.de/magazin/videos/10-roboter-die-die-welt-veraendern-werden/ and what i am getting is www.roboterwelt.de/10153713783568127/videos/10-roboter-die-die-welt-veraendern-werden/
This is my query URL (the app is not running via any Facebook SDK): graph.facebook.com/v2.5/me?fields=name,picture,posts.limit(100){comments.summary(true),likes.limit(0).summary(true),link,full_picture,created_time,id,message,type}&access_token=*
The fb-post i am working with is https://www.facebook.com/markedingplus/posts/664595060338842
Do I have to send any other paramters? Does anyone know what that number is?

Get URL (Link) for facebook post using post ID

I am trying to get a post from a company Facebook page.The link is for an application i developed that feeds of information from another applications database that uses the Facebook API.
i want to create a link eg www.facebook.com/{postID} that will take me to the specific post.I have tried numerous articles and all seem to send me to a 404 page. Please help.
Thanks
My Application uses the facebook api that accepts data related to a facebook page content (i.e posts,photo's,statuses etc).part of the api is that it saves the actual post id pertaining to a post for e.g. 302961133120433_576487772434433 into my applications database.As you may see that the post id has 2 parts separated by an underscore.So i needed to make a url based on this post id.
Solution for the link is:(2 parts of it,first being page id and second being actual post id)
Hope this helps.
You have facebook API doc on post here : https://developers.facebook.com/docs/graph-api/reference/v2.8/post
the URL you want is called "permalink_url" as field name, so the API call to get that link is in this format:
URL = 'https://graph.facebook.com/v2.8/' + postId + '?fields=permalink_url&access_token=' + facebookToken
Here is a screenshot for my testing in FB API explorer.
If you want to get a list of posts on IDs on a particular page, it doesnt seem to be documented but this works:
https://graph.facebook.com/teapartypatriots?fields=posts.id&access_token=<TOKEN>
If anyone only needs to redirect to the post URL, just put the post id after https://www.facebook.com/ and it will be automatically taken to the post.
more information from the official docs https://developers.facebook.com/docs/pages/publishing/

"unsupported get request" for a post that exists and is publicly visible

The following public post which is visible on the page it was posted (it is not "hidden") is a mystery to me: https://www.facebook.com/Orange.France/posts/833781953305851
i.e., it is not available in the page's /feed edge, and the graph API can't retrieve it either. The following command returns an "unsupported get request":
curl https://graph.facebook.com/170852259598827_833781953305851?access_token=XXX
I tried also the following without much success:
curl https://graph.facebook.com/833781953305851?access_token=XXX
In both cases, I tried the access_token of the page as well a random access_token generated from the graph explorer.
So, the question is: how can I retrieve this post through the FB API ?
You can't retrieve that post via the API - it was made by a user whose data cannot be accessed via the API by any app due to their privacy settings
You can see this by trying to load the poster's details (https://graph.facebook.com/<username>- it fails with the same exception)
Such posts will never be accessible via the API, because the person who made the post has explicitly disabled all apps from interacting with them or their posted content
If you want to prevent such users from posting on the page, there's an API-settable option called which will stop this - documentation for how to apply settings to the pages your app manages is here: https://developers.facebook.com/docs/graph-api/reference/page/settings
The specific option you need to enable to prevent platform-opt-out users from posting is called PLATFORM_OPTOUTS_CAN_POST
The main reason is not because of page, but it's because of the author turn the platform off.
You can't query the author basic info via Graph API.
The author can turn the platform off, so any Graph API query including comments wouldn't include him.

Facebook "Reviews" Tab Data -- Where is it stored in Graph API and how to access it?

I'm totally stumped here. I'm trying to get access to the data that appears under the reviews tab in the Facebook Page http://facebook.com/freemanfoxx (Page ID=149530265092626).
I've figured out that all data in a Facebook profile can be retrieved as JSON using the Graph API but I'm totally stumped about the data populated on the "Reviews" tab. It appears to be it's own Application separate from the Facebook core and this is probably why I'm lost.
Any leads/tips/experts out there? Here are some of the links I've been searching for Help.
developers.facebook.com/docs/api
developers.facebook.com/docs/reference/api/
developers.facebook.com/docs/reference/api/application/
My overall goal is to take this data into Yahoo! Pipes and then combine it with data from a Google Form to create an RSS feed to be output to a webpage I'm building.
Your thoughts and help would be GREATLY appreciated!
Ryan
Let's say your reviews tab on the facebook page is:
http://www.facebook.com/easyinspection?sk=app_6261817190.
6261817190 is the application id (not page id), and that is what you will be using next.
You can get all reviews by a request to:
http://graph.facebook.com/6261817190/reviews. If you do not want to go page by page, retrieving 25 reviews at a time (take a look at next page url), you can get it all in a single request, like this:
http://graph.facebook.com/6261817190/reviews?limit=100000000&offset=0
There is no API for this data. Your only chance will be a web page crawl ov your reviews and grab the content from there.