maybe this is stupid question, but how to retrieve comments and their replies (last 50) from Facebook profile page?
For example: api.get_connections("depechemode","posts") (or feed) give me only comments. Do I really have to create another request for every comment to get its replies? Is there better way to obtain all responses (comments + replies) from posts?
I tried FQL with "googled" examples, but without success...
UPDATE: I can get comments+replies from post with api.get_connections(post_id,"comments", :filter="stream") but is there any other option? It will be nice to get posts+comments+replies with one request...
I'll answer to myself:
graph.get_connections("askdotcom", "posts", :fields=>"message,id,created_time,comments.fields(comments.fields(from,message),message,from),from")
Just had to play with Graph API Explorer
Related
I'm not very used to working with Wix and I realized that it has a certain limit regarding the Blog layout. I would like to add the author of each post next to the post, but it would be too much work to do post by post.
So I created an HTML box to get the image and name of the author of the post. But I know I'm not doing it right. See:
Looking in the documentation the most I found was the function getPost() which returns various information from the post page, but 'author' or 'writer' is not among them.
My question is: is there any way to get the author data to display it in this box? Or, is there a simpler way to get to this desired layout?
Author information doesn't necessarily need to be inside an HTML box, if there's another way to do that, that's fine too!!
As seen on https://www.wix.com/velo/example/custom-post-page
You can get the ID of the post - which you already demonstrated you know how to do via getPost() then use that ID to retrieve the extra post data - which includes the currentPost.author entity that you are looking for. You can also see on the same page how this, and other data from that extra post data, can be brought into the page:
function assignPostDataToUIElements() {
$w("#authorName").text = `Written by: ${currentPost.author}`
}
User #Arnon De Paula definitely pointed us in the right direction with their link and should receive the bounty if this ends up being the answer you were looking for.
I'm looking for some guidance here.
Scenario:
I have a Post model with a polymorphic relation to a Comment model. Whenever I want to create a new comment for a given post I have the following endpoint:
$router->post('/posts/{post}/comments', 'PostsCommentsController#store');
So far so good. Now I want to add an Attachment model which will also be a polymorphic relation since I may need to add attachments to more things other than comments (ex: messages, etc).
My first idea was doing something in the lines of:
$router->post('/posts/{post}/comments/attachments', 'PostsCommentsAttachmentsController#store');
So the comment will belong to a post and will have an attachment.
This feels a bit "dirty" to me (especially the controller name) and the need of having 3 nested resources (maybe I'm just thinking too much).
Hope I was clear enough explaining my problem :)
Have anyone faced something like this before? How did you guys solve it?
Other approaches? Am I thinking completely wrong?
Open to ideas and suggestions :D
Thank you all.
I'd prefer Single Responsibility for each Controllers or route. So it's pretty clear what their actually do and handle. Let me give you example:
- Post
/posts -> list all post
/posts/{id} -> get specific post
/posts/{id}/comments -> get comments of the post
- Comment
/comments/{id} -> get specific comment
/comments/{id}/attacments -> get attacments of a comment
- Attachment
/attachment/{id} -> get specific attachment
For Controller name, just keep it simple. Just usePostController, CommentController and AttachmentController. It's quite clear I think.
After more researching, I actually realized that what I wanted to do was basically a file upload with metadata.
Came across this excellent post: HTTP/REST API File Uploads that explains it
PS: Thank you Dharma for the help and time.
Currently, Admin Export function does only support post & comment thread, user, group extraction. However, I would like to get the list of who LIKE each comment? Any idea to extract such information?
Thanks!!
See this page for the API that should answer your question.
https://developer.yammer.com/docs/usersliked_messagemessage_idjson
There isn't a way to do this in bulk but this should get you what you want.
Looking at the documentation on this API there is a page on performance to cut back the number of keys in the JSON dictionary returned. URL Shortener Performance Tips
Of the three dictionary keys returned in the insert request of this API, I am only interested in the shortened URL. The id key. Looking at the above documentation I would have expected this to work:
The POST request https://www.googleapis.com/urlshortener/v1/url?fields=id?key=YOUR-API-KEY
But with the fields=id added the request comes back invalid.
How do you set only a partial response for this API to only return the id key?
Turns out the comment from abraham steered me in the right direction on this problem. I was able to find the Try it tool option without OAuth and it worked also to my surprise. Looking at the request it generated I found that it was a syntax error on my part looking at the url given in my original question. It should be:
?fields=id&
not
?fields=id?
I just created an account with ESPN Developer, and I'm trying to get a list of all the Professional Golfers. I made the following request:
http://api.espn.com/v1/sports/golf/athletes?&apikey=[mykey]
Unfortunately, the browser only shows a handful of names (which are in alphabetical order). How can I get the API request to return all the golfers?
According to my research, you should be seeing all of the Golfers that they have.
If you use http://api.espn.com/v1/sports/golf?apikey=KEY, you will get a list of "all organizing bodies" in the sport. You can (if you have the patience) go through that list, and check to see if they are listed in the data returned from your (correct) API URI, along with the members of each section.
You can also use http://api.espn.com/v1/sports/golf/pga/athletes?apikey=KEY to get a list of athletes in that organization. Be sure to replace "pga" if you are looking for something else.
I just now created a Developer account there and requested a key to assist you with your question, so I could be wrong. If I am I will certainly come back to better answer your question.
I am reading this post http://www.javacodegeeks.com/2013/06/parsing-espn-api-using-java-and-google-gson.html
The NBA request http://api.espn.com/v1//sports/basketball/nba/athletes?apikey=KEY returns only 50 athletes, you have to use the offset parameter to get more
http://api.espn.com/v1//sports/basketball/nba/athletes?apikey=KEY&offset=51
So in your case
http://api.espn.com/v1/sports/golf/athletes?&apikey=KEY&offset=51
I am still reading the post but now I see I can return more players and the first request only got to players last name ending with B so geeze to get all athletes the JSON response would be huge!
I can't find this on the ESPN docs, so I don't know how developers are supposed to know this, there may be a better way but at least now I know how to get all the players.