I'm trying to find a way to get only the total number of shares of a video post, using version Graph API v2.9.
The sharedposts endpoint return full post object, and only batches of 8.
https://developers.facebook.com/docs/graph-api/reference/video/sharedposts/
The ?fields=shares parameter, can't be apllied on video objects.
Is there a way to get this data?
(p.s: I wanted to tag this question also with facebook-graph-api-v2.9, but this tag still does not exist, and I don't have enough reputation to create the new tag, if someone may add this tag please).
Instead of using only video_id as endpoint, use {page_id}_{video_id}/?fields=shares
Related
I am rendering to a page blog posts. Unfortunately, when the blog was initially set up, the pictures corresponding to each blog post was kept in a picture library for some odd reason. Now I need to dynamically display the appropriate picture with the correct blog post but I am having a hard time. I am using SharePoint 2016 and using REST API to query the picture library. I am able to query the library but I am not able to filter for a specific picture.
So, here's what I have,
the below works and shows the field that I need, Name
/blog/_api/web/lists/getbyTitle('blogPics')/items?$select=File/Name&$expand=File
the below filtering doesn't work
/blog/_api/web/lists/getbyTitle('blogPics')/items?$select=File/Name&$expand=File&$filter=Name eq 'imgName.jpg'
Any ideas why?
Thanks!
We can use FileLeafRef to filter the specific picture.
/_api/web/lists/getbytitle('blogPics')/items?$select=FileRef,FileLeafRef&$filter=FileLeafRef eq 'imgName.jpg'
I can't find the way to look for users on tumblr with a specific hashtag.
Example with hashtag "garden". How can you get a list with all users who used this hashtag? And if possible within a certain timeframe?
I guess it's easy but I can't find it.
kind regards
You can't just fetch all users who have used a tag, but you can iterate through posts that have that tag. Use the /v2/tagged route in the Tumblr API.
GET /v2/tagged?tag=garden
Parse the response as json and fetch each response[i].blog_name to construct a list of blog names that have used the tag.
You can then fetch the next page by using the response[i].timestamp field of the last post in the array. Just pass it as a before query parameter in your next request.
GET /v2/tagged?tag=garden&before=1480712397
If you'd like to limit to a specific timeframe, you can just start with the most recent date in before, and proceed until you hit a post with a timestamp past your oldest date.
I am looking for a method to get share/like count for each of the blogposts/articles which I create on my website. Interested in Facebook, LinkedIn and Twitter but Facebook is the most important right now.
Lets take this website as an example: https://googleblog.blogspot.com/
I have found a method to find this out for each url, but that will make it a lot harder for me as I would need to do it manually for each URL.
This is the query I used to get data for a specific URL:
https://graph.facebook.com/v2.7/?id=https://googleblog.blogspot.no/
Is there any method to get data for each and every url which contains: "company name" or something like this?
Will appriciate all the help I can get here.
No, there is no “wildcard” for Open Graph object URLs.
You can however request data for multiple URLs in one go, using the ?ids=foo,bar syntax – https://developers.facebook.com/docs/graph-api/using-graph-api/#multiidlookup
This theoretically works for up to 50 ids in one request (although with the ids being URLs in this case, you might only be able to request less, due to URL length limitations.)
I would like to have access to the links one shared on their timeline.
Using the API Graph Explorer, I see there is a way to access "links". However, it returns empty data. I believe that this might have been used when posting links in FB was done in a special way, different than posting "usual" status.
Then, I thought, I should probably get all the stream and filter the data for links. But at that point, I'm a little confused:
There are THREE different actions that seem to provide the very same data:
- https://graph.facebook.com/me/feed
- .../me/posts
- .../me/statuses
Are they actually all the same?
In addition, all seem to provide me information that is not up to date, but is true for some point in the near past. Moreover, I would like to know how I can get the relevant data from the beginning of the FB usage, or at least, for a given period of time.
Do an HTTP Get to me/links to get the most recent links the user has shared.
To limit it to a timeframe, you can do me/links?since=YYY&until=ZZZ.
Or you can use the paging object to get the previous and next url to use to get that other page of data.
I've been using the Facebook Graph API to display user posts. When I get the initial "page" of posts, the resulting data object has a paging property object with a previous and next URL property. I was hoping to generate navigation links based on this available paging information. However, sometimes these URLs point to an empty set of data, so I obviously don't want to navigate the user to an empty page.
Is there a way to find the total count of objects in a collection so that better navigation can be derived? Is there any way to get smarter paging data?
Update:
Sorry if my post isn't clear. To illustrate, look at the data at https://graph.facebook.com/7901103/posts and its paging property URLs. Then follow those URLs to see the issue: empty pages of data.
Since it pages the datas with date-time base. You can't get the knowledge of whether if there are datas or not before you actually send the request to it. But you can preload the data from previous url to determine is it suitable to dispaly a previous link in your web page.
Why be dependent of Facebook?
Why don't you preload all data for a user and save into a database. Then you fetch the posts from db and show to user. This way you have all the control on how many posts there are and how to manage next and prev.
I was going to try to post this as a comment to your question, but I can't seem to do so...
I know that the Graph API returns JSON, and while I've never come across a way to have the total number of posts returned, depending on what technology you are using to process the response, you might be able to capture the size of the JSON array containing the posts.
For example, if I were using a java application I could use the libraries available at json.org (or Google GSON, or XStream with the JSON driver) to populate an object and then simply use the JSONArray.length() method to check for the number of posts returned.
see:
http://www.json.org/javadoc/org/json/JSONArray.html
It might seem like a bit of a simplistic solution, but might be the type of work around you require if you can't find a way to have Facebook return that data.
Can you specify what technology your application is based in?