I have just implemented the HWIOAuthBundle in my symfony project. Actually, it is configured with facebook and I am wondering if it supports retrieving friends list, gender and country?
If yes, could you please provide me an example of code for the function public function loadUserByOAuthUserResponse(UserResponseInterface $response)?
It would be really helpful.
Thanks.
I found the solution by my self!!!
HWIOAuthBundle supports retrieving any thing you want. All what you have to do is to specify it in the facebook api then through the method getResponse() you will have access to them.
$attr=$response->getResponse();
// then get your field like this
$user->setGender($attr['gender']);
I guess now it is easy.
Related
I am looking to search Facebook public profiles using the Graph API with parameters like name, location and age. To accomplish this I created a Facebook app to get an app ID but I am unsure as to how to proceed to make the query to the API.
To try it out I tried using the explorer (https://developers.facebook.com/tools/explorer/) but I am unable to get any results that does not contain "me". I made sure to get a access token and enter a query like the following:
search?q=tobias&type=user&fields=id,name
The only reply is:
{
"data": [
]
}
I feel like I am missing something but I have been unable to figure out what, please advice.
The search endpoint is broken since 2018-04-04 for certain search types, including pages and users.
Search API
You can no longer use the /search endpoint with the following object types:
event
group
page
user
See
https://developers.facebook.com/docs/graph-api/changelog/breaking-changes#search-4-4
Due to what has recently been in the news, searching for users has been deprecated, and is not supported through Facebook APIs.
I can't seem to find the section in their api reference. I tried it as a searchquery but it doesn't seem to work. api.soundcloud.com/stream or /explore return a 404, so that doesn't work either
Thats actually not a part of the public API.
But its quite easy to grab your call from the dev console.
Thats an example call from my user:
https://api-v2.soundcloud.com/stream?user_id=e87647259112403eaa239b6e2c510e46&sc_a_id=e87647259112403eaa239b6e2c510e46&user_urn=soundcloud%3Ausers%3A1672444&promoted_playlist=true&limit=10&offset=0&linked_partitioning=1&client_id=02gUJC0hH2ct1EGOcYXQIzRFU91c72Ea&app_version=a089efd
To make that call work, you need to modify the headers.
These answers may help you:
Retrieving the "recommended" playlist via API call?
soundcloud: Is api-v2 allowed to be used and is there documentation on it?
How to get "all" tracks related to an artist with Souncloud API
Using these endpoints does not go inline with SoundClouds TOS.
I'm using the Facebook Graph API, Mobile hosting API to post a link with the following:
https://graph.facebook.com/{APPID}/app_link_hosts?access_token={ACCESS_TOKEN}&name=Puzzle_1420352145684&ios=[{"url":"MyAPP://playerPuzzles/1420352145684","app_store_id":{MYAPPID},"app_name":"MyAPP"}]&web={"should_fallback":false}
I get the correct result in the form of the ID of the link, with no error.
But when I query the link with
https://graph.facebook.com?ids={LINK}&access_token={ACCESS_TOKEN};
I don't get any app-link data the object is there but empty not even the name.
{"http://fb.me/777314042342441" = {
id = "http://fb.me/777314042342441";
};
}
Is there something wrong in my posting that doesn't allow the data to get posted?
Thanks for you help in advance.
It seems that the facebook documenatation is wrong. I finally found a solution using the graph explorer.
To correctly fetch the data use this style of URL.
https://graph.facebook.com/{APP-LINK-ID}?fields=ios,name,web&access_token={ACCESS_TOKEN};
Please note that you have to call out all the fields you want. The object at least for me didn't include the app_links structure like the documentation.
Here is the link to the wrong Index API
Here is the app_links object structure you can see all the fields you can fetch.
Hope this helps everyone.
Is it possible to retireve from Facebook both basic information and additional variables at the same time? For example, using .NET sdk and calling
client.Get("me")
I will get name, first_name, last_name, etc. and other public information.
I can also run
client.Get("me", new { fields = "name,photos" })
but this gives me only variables I've asked for, without basic information. Do I need to call it twice? Eventually I could use the second option and ask for all basic fields individually like username, gender, but in this case how to ask for "other public information" as well?
Thanks in advance
Bartek
Your point is interesting. But /me only works as a shortcut to quickly get all basic fields at once. You have to override it.
Don't call it twice, since API requests take some time. I advice you to make only one complete request by specifying all the fields you really need.
I am using Graph API in my application. I am fetching user's facebook wall feeds using graph API also getting details of particular post i.e (Like count,Comments etc).
but i want to allow user to Like and Comment any post from the application itself.
what is the request format for that?
Please help me or give any pointers.
Regards,
Sanket
You would be well served to check out the Publishing section of the documentation. It provides information such as this.
One example is liking, which is defined as:
Method: /OBJECT_ID/likes
Description: Like the given object (if it has a /likes connection)
Arguments: none
Basically, just initiate a Graph API call to something like:
[facebookObject requestWithGraphPath:#"98423808305/likes" andDelegate:self];
That will "like" a picture from Coca-Cola (ID taken from the documentation).
Edit 1
According to the documentation:
Most write operations require extended permissions for the active user. See the authentication guide for details on how you can request extended permissions from the user during the authentication step.
Are you sure you have enough privileges? Unfortunately the documentation is very unclear as to whether it serves the dual purpose of liking the object and returning the likes already on that object.
Edit 2
I did some more research into what could be causing this and came across this question and answer that indicated that the code I posted above using requestWithGraphPath:: should work. However, it does not due to a bug on Facebook's Bug Tracker.
Unfortunately, it looks like there is no way to "like" an object via the Graph API, which seems very strange to me. Perhaps it is possible with the legacy REST API instead of the Graph API?
Edit 3
Well, it looks like your best bet is the stream.addLike method of the legacy REST API which you can still call using the Facebook iOS SDK. You should be able to use the stream.addLike method to "like" something in the "stream". Unfortunately, it doesn't appear to support photos, videos, etc. Only posts and comments.
Finally i found the solution for LIKE option
We should use following method for like option.
-(void) requestWithGraphPath:(NSString *)graphPath
andParams:(NSMutableDictionary *)params
andHttpMethod:(NSString *)httpMethod
andDelegate:(id <FBRequestDelegate>)delegate
graphPath = /OBJECT_ID/likes
Paramas = dictionary with comment ,for like option use empty dictionary
HttpMethod should be POST
you should get response = true if the LIKE request is successful.