I'm using : graph.facebook.com/me/feed?access_token=... to get my wall in json format, however, I can't get all the wall. I can get almost all.
I can get the posts where I'am tagged with #my_name..
I can't get the posts where I'am invoqued by "Who are you with?" option..
however, in the wall web application y can see both messages. but using graph api not.
The documentaion says: "Profile feed (Wall): graph.facebook.com/me/feed?access_token=." ..
I thinks the Wall == graph.facebook.com/me/feed?access_token... but apparently I'm wrong :( ..
Thanks in advance ..
Edit.. more information:
Image 1: We can see posts 1,2,3 and 4 (in red) in the wall ..
Image 2: We can see that the posts 2 and 4 had disappeared of json result.
both, post 2 and 4 are using "Who are you with?" "With hall9000"..
Image 1: http://i.stack.imgur.com/y1mFp.png
Image 2: http://i.stack.imgur.com/9kIKG.png
Related
I'm working on Android app which uses Foursquare API. For fetching results I use /venues/explore endpoint. I want to make fancy detail screen with set of photos as Foursquare does(example) So, according to documentation, when I make request for nearby places, I use parameter venuePhotos=1, but always get one photo from the count result of featured photos (example). Is this a bug of API or I got it wrong :) ?
I'm using hurl.it for monitoring response from certain requests.
here is my API request(I removed my client id and secret):
GET https://api.foursquare.com/v2/venues/explore?venuePhotos=1&limit=10&radius=500&v=20160215&ll=55.693053,12.584903&client_secret=//&client_id=//
client_id:
client_secret:
limit: 10
ll: 55.693053,12.584903
radius: 500
v: 20160215
venuePhotos: 1
And I get always one photo in photo count for regular and featured photos in every venue. Response example:
{"reasons": {},"venue": {"id": "4c41ae26af052d7fbba97d79","name": "Femmeren - jazz-værtshus","contact": {},"location": {},"categories": [],"verified": false,"stats": {},"price": {},"rating": 8.2,"ratingColor": "73CF42","ratingSignals": 11,"allowMenuUrlEdit": true,"photos": {"count": 1,"groups": []},"hereNow": {},"featuredPhotos": {"count": 1,"items": []}},"tips": [],"referralId": "e-0-4c41ae26af052d7fbba97d79-3"},
Thanks for clarifying your question. The venuePhotos=1 parameter will include a single photo in the response from the venues/explore endpoint. This is extremely useful if you need to display a single photo in a list of venues. To get more photos for a venue, you need to hit the venues/photos endpoint and pass the venueId you want the photos from -> https://api.foursquare.com/v2/venues/VENUE_ID/photos
I have read this "Facebook comment-count always showing 0" but it isn't my case.
I use graph API for android to count number of comments on a url link. Just look a simple example:
1 - Use graph explorer: Press this. You will see the result is "comment_count": 47 at this time, and a line "id": "https://developers.facebook.com/docs/plugins/comments/" that content the link we count.
2 - But when I use android facebook graph to query the link like this:
String linkt = "https://developers.facebook.com/docs/plugins/comments/";
String graphLink = "/v2.2/?format=json&fields=share{comment_count}&id=" + linkt;
I got the result {"id":"https:\/\/developers.facebook.com\/docs\/plugins\/comments\/?format=json","share":{"comment_count":0}}
Do you see the "?format=json" was automatically added to my url. So the result is always 0. Because it a wrong url.
Thank you for all help.
I added "&" after my link to separate with "?format=j", then it worked.
I am having trouble while trying to post a message on the current end-user Facebook wall with my Android Application.
So far :
The user is logged in with all the required permissions, especially
the publish_actions permission ;
I am using the last version of Facebook SDK 3.x & Graph API v2 as of May 2014
Post to wall works now as of EDIT 2, but there are issues with
privacy settings : post cannot be seen by anyone not even the
recipient who is tagged in the post ! See EDIT 2 for more details
Here is the documentation for posting a message on the user wall :
https://developers.facebook.com/docs/graph-api/reference/v2.0/user/feed (go to Publishing)
Regarding the message that needs to be posted on the user' wall, I need to tag some friends that were previously selected by the user.
But to use the tag field I need to use the place field.
The documentation says :
Name: tags
Comma-separated list of user IDs of people tagged in this post. You cannot specify this field without also specifying a place.
Type: csv[string]
Name: place
Page ID of a location associated with this post.
Type: string
What is location page ID ? How do I get it ?
Oddly enough, in my specefic case, I am offering the possibilty to the user to share is upcoming travel on Facebook.
More oddly enough, this travel is defined by dates and a destination (name of destination + latitude & longitude). The user has the possibility to also share this travel to his friends that are located in his travel's destination hence the need to tag his friends to the wall post.
[EDIT 1]
After looking into #Tobi solutions, I managed to post a message on the end-user wall (in my case me, since I am the developper).
So far : the message is correctly displayed with a friend tagged (a dummy account I use for tests purpouses) and there is also the place : Paris, France.
Using the following search query (thanks #Tobi) search?q=Paris,France&type=place I can get the ID of Paris, France.
Since I did not code the part to retrieve the Place ID it put it manually in the code for the sake of testing the feature first.
[END OF EDIT 1]
[EDIT 2]
I noticed I forgot to add the part with the privacy values to my args Bundle. But it did not change a damn thing : my post is only visible to me alone.
Going to my Facebook wall, here is what I get :
Hovering the public parameters of the posts (a padlock icon) says "All tagged persons".
Clicking on the icon shows the list of settings with only "Only me" selected.
Why "only me" even though I specifically said me + my dummy account in the request parameters ?
Even weirder : changing the property of the publication parameters to "customized" with my dummy account does not change a damn thing as well. Just why ? Facebook is really getting on my nerve...
For the rest, the message content is correctly displayed and the related place is the good one. At least a got that correctly. But still, I just don't get the rest ...
[END OF EDIT 2]
So here is the updated code :
if (this.session != null && this.session.isOpened()) {
final Bundle args = new Bundle();
if (this.selectedContacts.isEmpty() == false) {
args.putString("message", message);
args.putString("place", "170558129707208"); //manually added Paris, France ID
String tags = "";
//here I made some modifications regarding the tags so that is built correctly
for (int it = 0; it < this.selectedContacts.size(); it++) {
final String name = this.selectedContacts.get(it).toString();
final String friendID = String.valueOf(getIdFromName(name)); // returns an int
if (it == this.selectedContacts.size())
tags += friendID;
else
tags += friendID + ",";
}
// Forgot to add privacy values to bundle !
final JSONObject privacyValues = new JSONObject(); //not android JSON, but JSON-Simple lib
privacyValues.put("value", "CUSTOM");
String allow = this.currentUser.getId() + "," + tags;
privacyValues.put("allow", allow); // to limit the visibility of this post
args.putString("privacy", privacyValues.toJSONString()); //forgot that one...
final Request shareTravelRequest = new Request(this.session, this.currentUser.getID() + "/feed",
args, HttpMethod.POST, new Request.Callback() {
public final void onCompleted(final Response response) {
//TODO
}
}
);
final Response response = shareTravelRequest.executeAndWait();
if (response.getError() == null) // in this case, no error occurred
return true;
else {
this.lastErrorMessage = response.getError().getErrorMessage();
Log.e("Something went wrong while posting Facebook message", this.lastErrorMessage);
Log.e("Error type is", response.getError().getErrorType());
Log.e("Error code is", String.valueOf(response.getError().getErrorCode()));
return false;
}
}
}
Unfortunately I must have mistaken somewhere because although the post does appear on my Facebook wall with my dummy account tagged and with the correct link to the place, my dummy account cannot see the post.
I tried creating manually the same post on my Facebook wall by using the following settings :
First I supplied a message
Second I supplied a place
Third I tagged my dummy account
Four I choose who can see this post : me and my dummy account
And finally, I post the message.
In this case, my dummy account sees the post both on its wall and on my wall.
So I would like to know what parameters I must get wrong because there is not much parameters and I just don't see why.
Thanks !
You can either use the Search and use the type place (https://developers.facebook.com/docs/graph-api/using-graph-api/v2.0#search), or, if you have positioning date, use an FQL query on the place table (https://developers.facebook.com/docs/reference/fql/place/) as described here: Facebook places: order results by distance
Use two test accounts made via Facebook Developer App settings and not a dummy account that breaks TOS. Since you request publish_actions you probably didn't submit the app for review. Unless your dummy account is a developer/tester in roles as well (which is breaking the TOS again) then your dummy account will not be able to see the post.
Only developers and testers of an unpublished application can see posts made by that application.
Hi my task is very straight fw:
I want to query my newsfeed for all the posts it contains(from the last 24 hrs), that has the word "nice" in them.
I am using restFB client.
I tried this: (using Graph API)
Connection<Post> targetedSearch = facebookClient.fetchConnection(
"me/home?q=facebook", Post.class, Parameter.with("q", "nice"),
Parameter.with("type", "post"));
This is the best Answer I could find is from here, is using FQL
SELECT post_id, app_id, source_id, updated_time, filter_key, attribution, message, action_links, likes, permalink FROM stream WHERE filter_key ="nf" and strpos(lower(message),lower("nice")) > 0
I have a method in my app that allows the user to "like" a post in his/her news feed. It's done with a simple graph request using HttpMethod.POST. But when I try to do an "unlike" action using HttpMethod.DELETE, I get an error callback:
02-08 00:35:57.298: I/Detail(2628): {Response: responseCode: 403, graphObject: null, error:
{HttpStatus: 403, errorCode: 200, errorType: OAuthException, errorMessage: (#200)
Feed story publishing to other users is disabled for this application}, isFromCache:false}
Now I assume this has something to do with the latest attempt to make all apps that integrate with Facebook use all Facebook looking dialogs and styles, but I could be wrong. Here's the roadmap post that has me suspicious:
Removing ability to post to friends walls via Graph API We will
remove the ability to post to a user's friends' walls via the Graph
API. Specifically, posts against [user_id]/feed where [user_id] is
different from the session user, or stream.publish calls where the
target_id user is different from the session user, will fail. If you
want to allow people to post to their friends' timelines, invoke the
feed dialog. Stories that include friends via user mentions tagging or
action tagging will show up on the friend’s timeline (assuming the
friend approves the tag). For more info, see this blog post.
Any ideas on what I could be doing wrong, or is Facebook just ruining me? Thanks!
EDIT: Here's the code I'm using to run the request.
Request likeRequest = new Request(Utility.fbSession, null, null, null, new Request.Callback() {
#Override
public void onCompleted(Response response) {
String responseString = response.toString();
Log.i("Detail", responseString);
updateDetail();
}
});
HttpMethod nextLikeCall = HttpMethod.DELETE;
likeRequest.setHttpMethod(nextLikeCall);
likeRequest.setGraphPath(itemId+"/likes");
likeRequest.executeAsync();
When you grab the post id from the graph data, it should be in a format like: XXXXX_YYYYY. The XXXXX is simply the users id and YYYYY is the actual post id. What you need to do is extract and use just the YYYYY portion of the post id that graph gives you. so instead of graph.facebook.com/XXXXX_YYYYY/likes.... you want to send graph.facebook.com/YYYYY/likes. This will work with both liking and unliking, you can test in graph explorer first before hacking together a substring extraction method.
Not sure how to extract a section of a string on Android, but I know in Objective-C/iOS, it can be done like this (code not tested, for reference/idea) :
SString *actualPostIdStr; //The String we will put the actual postId in
NSString *oldIdStr = //<the string in format XXXXX_YYYYY>
NSInteger charCount = [oldIdStr length]; //get the length of the original XXXXX_YYYYY string
NSRange fRangeCount = [oldIdStr rangeOfString:#"_"]; //get count of characters to remove (XXXXXX)
if (fRangeCount.location != NSNotFound){
NSInteger startingPos = fRangeCount.location + 1; //get the starting character position of the actual postId
actualPostIdStr = [[oldIdStr substringWithRange:NSMakeRange(startingPos, charCount - startingPos)] copy];
}
Hope this helps.
EDIT:
Ok, so I have been playing around with likes all day... It seems that this method sometimes doesn't work, but it all depends on the type of graph object which you are attempting to like/unlike. For example... plain status posts, this method works perfectly. However, I ran into a problem when trying to like a photo with a message/story post object. It turns out, in the graph data for this type of post object with photo, there is an additional paramter called "object_id", in addition to the plain "id" that is in status post graph data. in this case, with the photo and story post, you need to pass the "object_id", unaltered for successful unliking.
This mess seems like either a bug on FB's end, or they are making changes and disallowing likes/unlikes from graph api & just forgot/haven't to told us yet :) hopefully the former. In the mean time, you're just going to have to use my above answer, but just make sure you test with as many different types of post objects you can find, and use if conditions when a different id (portion of "id"... "object_id"... etc) is required.
Sometimes Daniel McCarthy's method don't work. In this case we need get Graph API request XXX_YYYY, find field object_id and unlike this object_id fid.