Detect user mobile device on Facebook graph API - facebook-graph-api

Is there a way of detecting the user mobile device or at least know if the user is also using Facebook on a mobile device?

Read the Mobile Device Filtering section on the below url:
https://developers.facebook.com/docs/guides/games/custom-muti-friend-selector/
You should do a Graph API request like the below:
GET https://graph.facebook.com/USER_ID/?field=devices
Just want to add that the field parameter didn't work for me, but fields works. So you can try the below url alternatively (I would suggest to try it first).
GET https://graph.facebook.com/USER_ID/?fields=devices
And do not forget you will need an access_token
GET https://graph.facebook.com/USER_ID/?field=devices&access_token=....

Related

Is it possible to get the Instagram profile picture and other basic details?

I'm trying to get the details of the user using the access_token from the Instagram APIs, Instagram Basic Display API and Instagram Graph API. What I found is the details are bit messy and by going deep into it I'm not able to conclude the final result as I want.
What I got to know during the implementation is that Instagram has stopped the public APIs. does that mean apart from getting auth-token then had stopped everything?.
I have even tried the Instagram Basic Display API which is only giving the access of 4 fields account_type, id, media_count, username. Is it possible to get any other field from the same API?
If so How do I get the profile picture of the user and other basic details of the Instagram user?
any help will be appreciated
Currently, the API endpoint for retrieving a user's profile information only allows for the retrieval of the 4 fields you listed above. This is, up to now, all that has been made available for retrieval through the me endpoint of the Instagram Basic Display API for getting a User node.
Until the API developers further extend the API's endpoints and capabilities, you won't be able to use this API programmatically to get a user's profile image.

How to get multiple user images from Twitter (OAuth)?

I have a log in to my site using Twitter. It all works great.
Whilst I can do a call to get the current users details etc and log them in, I'm a bit stumped on how I make calls to get the profile images of users stored in my database; those who may not be using the website at that time?
I am using the monkehTweets Twitter library:
https://github.com/coldfumonkeh/monkehTweets
To get the current user, I sign them in and do this:
application.objMonkehTweet.setFinalAccessDetails(
oauthToken = returnData.token,
oauthTokenSecret = returnData.token_secret,
userAccountName = returnData.screen_name
);
local.userDetails = application.objMonkehTweet.getUserDetails(user_id=returnData.user_id);
As part of the log in process on my website, if a user hasn't used the site before, I store their Twitter ID.
I was hoping to then use this to display their profile images on the posts they make to other users.
What is the best approach to achieve this? With the Facebook API, you can make requests to a URL with the ID...but Twitter doesn't seem to allow this.
I would prefer not to 'store' the image on my own file system. This was a possibility I had in mind, but I'd rather use the API to always ensure the latest data.
Is there a way to use my own app details through OAuth to access this?
Any help would be greatly appreciated.
Thanks,
Michael.
PS - I am using ColdFusion (Railo) to do my server-side based authentication.
The twitter api returns profiles with the images (if you are looking it up) in the key profile_image_url
So you could store them in a cache like:
if(!cacheKeyExists(twitterID)){
// Code to get a twitter profile through monkehtweet
cachePut(twitterID, profile.profile_image_url);
}
return cacheGet(twitterID);
Hope this helps

Get locale using graph api NOT getSignedRequest

I know it is possible to get the locale of the user with getSignedRequest, and it is possible to get the locale of the user with https://graph.facebook.com/me?fields=locale once they have authorised the app. But what is the equivalent graph api url that I can use before they have authorised the app? All my code is with the graph api so I really dont want to have to switch now to using the whole facebook->getSignedRequest() stuff. I can't find it anywhere but seems silly this functionality has not been provided in graph api?
You have to pick between using the signed_request (which is sent in a POST request to all apps on Facebook) or authorizing the user.
If you don't do one of these, then you won't know what the Users ID is, so you will never be able to identify their locale.
The signed_request just requires you to be able to capture request data and then perform the parsing logic outlined in the doc linked to above - it doesn't require the use of any SDK or API, just the ability to read requests (most languages will be able to do this).

Get new profile cover with sdk

Is it possible to get and to change the new porfile cover (mine or my friends' profil cover) with the sdk php or JS ?
It is possible to get the Facebook's user cover image using the Graph API. You have to add 'fields=cover' to the user request. The response is an array of fields id, source, and offset_y. You need an access token for this.
You cannot update the cover photo using the API, only retrieve it.
http://graph.facebook.com/[USER_ID]?fields=cover
It's still not possible with the current APIs exposed by Facebook.

Facebook API Like a Page with Auth Token

I've got a Facebook oauth token and I'm trying to Like a page for a user who has given me permission to do so. Assuming 123456789 is the id of the Facebook page the user wants to Like, I post to this page and get the following error:
https://graph.facebook.com/123456789/likes?access_token=...
{
"error":{
"type":"OAuthException",
"message":"(#3) Application does not have the capability to make this API call."
}
}
This page of the Facebook documentation (https://developers.facebook.com/docs/reference/api/) says:
You can comment on or like any object that has a /comments or /likes
connection by posting to https://graph.facebook.com/OBJECT_ID/comments
and https://graph.facebook.com/OBJECT_ID/likes, respectively
The user wants to Like a Facebook Page and the Page documentation (https://developers.facebook.com/docs/reference/api/page/) shows that it does have a /likes connection, so it should be Like'able via the api... but it's not working. Any ideas?
Currently this is only possible with the old (and DEPRECATED) REST API. Using the method "pages.addFan". Though this method is not visible in Facebook's API Documentation.
So I assume that this is also possible somehow with the new Graph API, because their Facebook mobile apps will need to move on to their new APIs soon, and they make use of the Page Like function.
What's really weird, is that their brand new iPad app, is based on the old REST API! Interesting...