How to retrieve multiple user account details through their Facebook IDs in graph API? - facebook

This could be a duplicate of here and here, but can some one provide a complete working example for following.
I have set of different Facebook account Ids, and i need to get the respective account details(user name etc) from these account ids. I need to send a Batch Request for Graph API. Something as follows,
(https://graph.facebook.com?ids=user1, user2, user3,...)
Is this possible as pure HTTP GET request ?
I am using Facebook SDK with Android for the moment. I have gone through the API doc but unable to build the required query yet. Please help.

Maybe post a snippet of your code so we can try to solve your problem better. With the info you provided, the URL https://graph.facebook.com/?ids=user1,user2,user3 works just fine and returns 3 users.
The URL format looks correct. Keep in mind the total character limit, but otherwise I suspect you are stuck in a different place (e.g. sending the query or saving the result).

Related

Get results for specific facebook marketing campaigns objectives

Each Facebook ad campaign has an objective, such as LINK_CLICKS or CONVERSIONS.
In Ad Manager, one can see the performance of each of their ad campaigns. There is a column called "results" that has the number of objective-specific conversions for that campaign. So for example, if the objective is PAGE_LIKES then results would show the number of page likes resulting from the campaign, but if the objective was LINK_CLICKS then results would show website clicks.
My question is: Is there something in the Insights API that equates to the results column in Ad Manager? Part of the reason I ask is for ease and consistency, but also some of the objectives are ambiguous, e.g. BRAND_AWARENESS.
No, I haven't been able to easily replicate the results and cost per result columns from the ad manager with an API call.
First you can check the URL when in the ad manager to see which columns are selected by looking at the GET parameter columns:
https://business.facebook.com/ads/manage/powereditor/manage/ads?act=...&business_id=..&columns=name%2Cerrors%2Cdelivery%2Cresults%2Creach%2Cimpressions%2Ccost_per_result&...
Decoding this gives the following fields:
columns=name,errors,delivery,results,reach,impressions,cost_per_result
Now it looks like we could simply use the result and cost_per_result fields, but that gives an error:
(#100) results, cost_per_result are not valid for fields param.
This is expected as the API document doesn't specify results and cost_per_result as valid fields.
Now when in the ad manager we can also see the API calls use the network tab of developer tools to see it making API calls to retrieve data. This shows us the result and cost_per_result fields being used. You can actually copy the request URl and see it working... somehow..
Trying to recreate this API call in the Graph API Explorer only worked for me when I copied the access token from the previous call. This makes me feel that the business manager has a special access token.

Facebook API Lead Ad webhook lead retrieval

I have setup a webhook for Facebook Lead Ads
It is receiving data like this:
{"object":"page","entry":[{"id":"718196074978224","time":1453818316,"changes":[{"field":"leadgen","value":{"ad_id":"399579767903","adgroup_id":"971076277715","created_time":1453789516,"form_id":"930912320812","leadgen_id":"151977133461","page_id":"718196074978224"}}]}]}
The next step is to retrieve the details.
The docs say
https://graph.facebook.com/v2.5/
but if I use the leadgen_id (151977133461) this returns
"singular published story API is deprecated for versions v2.4 and higher"
I've also read that _ might work, but that returns a different error.
Answered my own question: subscribed_apps wasn't set up correctly
You just need page access token to retrive the values from the lead. You need to make a GET call on
https://graph.facebook.com/v2.11/<leadgen_id>?access_token=<page_access_token>
For more info go through this link it will help you: http://tanmayverma.com/reactjs/storing-facebook-lead-data-in-our-database-in-real-time-using-reactjs-meteorjs-and-fbs-javascript-sdk/

How can I search for taggable_friends (FB API) form within my app without using a limit on my request?

I am currently using Facebook's OpenGraph to obtain taggable_friends. By default and as of FB API > 2.1 the request only returns 25 objects. You can add a limit and increase your data response but you have no parameters you can pass. It just doesn't feel right to increase the limit with a hard coded number. So, one of the features of that app is that you can search for taggable_friends and select them. If you return a large limit to obtain (in most cases) all of your friends can take a while. Let's say you only get the first 25 and you search for a person that is in a batch - you don't know where. Since you have no parameters to pass to your request, a searchTerm for your your API call is out of the question.
Has anyone ever done a batch call? Facebook allows for multiple requests using some sort of batch calls. How would that look like in JS code?
I can use my users information to obtain the amount of friends he/she has and set a reasonable limit. That helps in the majority of cases but doesn't solve the problem.
Did someone ever encounter that problem and solved it?

SoundCloud API returning 0 tracks despite user having tracks

I'm trying to get the tracks of specific users but for some users, even though they have tracks, the SoundCloud API return an empty list.
For example, the following user has 17 tracks as you can see from his track_count
http://api.soundcloud.com/users/1250904?client_id=XXXXXX
If I try to get his tracks it returns an empty list
http://api.soundcloud.com/users/1250904/tracks?client_id=XXXXXX
Is it possible for users to make their songs not available via API? Is there a field on the user that can distinguish this?
This is very interesting. Using a normal CLIENT_ID I generated myself, I get the same results you do. Additionally, if I try to hit the API for information about a specific track, I get a 403 Forbidden error:
HTTP GET https://api.soundcloud.com/tracks/149151252.json?client_id=XXXXXX
There could be a few reasons why this is occurring:
The user has hit their download limit for all of their tracks.
The user has disabled oEmbed, causing the API requests to 403 (see this post).
The user has somehow managed to block normal API access to their tracks.
I'm leaning on choice 3 here. I've done some testing with some other CLIENT_IDs in this question trying the CLIENT_ID used by the youtube-dl application. Using their _IPHONE_CLIENT_ID, I was able to see information for all 17 tracks. If my understanding of that key is correct, it is a master API key used by SoundCloud for their iOS application, which would explain why that key works and others do not.
This user must have some setting enabled to block standard API access to their tracks.

Twitter4j - Build a graph composed by tweets and their respectives retweets

I need to build a graph in which some nodes are tweets and others are retweets which point to their respective tweets. I start my application doing a search for some subject, let's say "computer". Then, I gather some number of tweets that contains that subject. From there, I want to search for the retweets of these tweets and then, build my network by linking ones to the others.
The problem is that when I try to search for retweets of a tweet using its id, the application throws an exception saying that authentication credentials are missing. Is there a way of getting these retweets without requiring external authentication ('cause my app is not interactive), I mean, is it possible that I can get these information only with my credentials (login,password)?
Maybe that's a silly question I've asked about, but since I'm a beginner at this API and Twitter as well, any help is appreciated.
using Twitter4J? try invoking getReTweets() method. More documentation here.
Read carefully point Number 7 in samples here. Authentication credentials means there are 4 Strings. Two of your application(consumer keys) and Two of the user(access Tokens) using application.