I want to show the profile picture using the graph api using the following link fpor example :
https://graph.facebook.com/me/picture?redirect=0&height=200&type=normal&width=200
I get the response :
{
"error": {
"message": "An active access token must be used to query information about the current user.",
"type": "OAuthException",
"code": 2500
}
}
Where in the link they say
Because profile pictures are always public on Facebook, this call does
not require any access token.
The me in the URI is just a placeholder, you need to put an actual Facebook user-id in, like the title (/{user-id}/picture) of your linked page suggests.
For example:
https://graph.facebook.com/snoopdogg/picture?redirect=0&height=200&type=normal&width=200
...returns the following:
{
"data": {
"url": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-ash3/c11.0.433.433/s200x200/598452_10151897536239807_882122819_n.jpg",
"width": 200,
"height": 200,
"is_silhouette": false
}
}
Related
I want to get all the posts of a facebook page. I am following the link https://developers.facebook.com/docs/graph-api/reference/v2.8/post
For example URL : http://graph.facebook.com/v2.8/{page_id}/feed%20HTTP/1.1
I get the response as :
{"error":
{
"message": "Unknown path components: /feed HTTP/1.1",
"type": "OAuthException",
"code": 2500,
"fbtrace_id": "Em5dm7wPr9k"
}
}
I got the page_id from my facebook page.
Is my URL correct? Is this the correct way to get all the posts?
This is the correct way: https://developers.facebook.com/tools/explorer/?method=GET&path=bladauhu%2Ffeed&version=v2.8
You don´t need the Page ID, but you need to get rid of the " HTTP/1.1" in the API call. It´s just http://graph.facebook.com/v2.8/{page_id}/feed.
I am trying to use the Google Health API with a REST API. I am aware there is an API available for Android but I am trying to port that behavior to a back end.
I am playing around in the Oauth playground; I am trying to get a aggregated query. I've tried many things but none of them return anything (only get errors) There is no example featured on the google website itself. Anyone has experience with this API?
I have found a few examples here on stackoverflow but none of them conclude with a solution or a full query that can fit as an example.
Here and Here
If I just could get a working aggregate example I would work from there.
Here is my request to https://www.googleapis.com/fitness/v1/users/me/dataset:aggregate:
{
"startTimeMillis": 1451647796000,
"endTimeMillis": 1458127796000,
"aggregateBy": [
{
"dataTypeName": "com.google.height"
}
],"bucketByTime": {
"period": {
"type": "day",
"value": 1,
"timeZoneId": "org.joda.timezone.DateTimeZone"
}
}
}
Response:
{
"error": {
"code": 400,
"message": "Bad Request",
"errors": [
{
"domain": "global",
"message": "Bad Request",
"reason": "invalidArgument"
}
]
}
}
You forgotten "durationMillis" field on "bucketByTime" and "dataSourceId" on "aggregateBy".
Timezone syntax is like "America/Los_Angeles" not "org.joda.timezone.DateTimeZone". You can see this strings on http://joda-time.sourceforge.net/timezones.html
I am trying to get the birthday from the Google API, but the retrieved data in HWIOAuthBundle do not contain it.
I am wondering if the specified scope for google plus api in config.yml is correct or not!
If not, please give a link or the corrected scope.
google:
type: google
client_id: %client_id%
client_secret: %secret_id%
scope: "https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile"
paths:
email: email
profilepicture: picture
I just used and tested it using Try It. I tested it with all of the different scopes.
https://www.googleapis.com/auth/plus.login Know your basic profile
info and list of people in your circles.
https://www.googleapis.com/auth/plus.me Know who you are on Google
https://www.googleapis.com/auth/userinfo.email View your email address
https://www.googleapis.com/auth/userinfo.profile View basic
information about your account
It doesn't appear to matter you get back the birthday in all of the scopes. But what does matter is that the Users Birthday must be set to public in the Account. If it's set to anything else, your circles, only you, it's not listed. This appears to be true even when you are trying to see your own information. (Sending Me.)
Update and the year is 2018
The People api now returns the birthday of the current user
People.get However i suspect its linked to google+ so if the user hasn't filled it out you probably wont get info.
GET https://people.googleapis.com/v1/{resourceName=people/*}
Send Resournce name of people/me and birthdays personFields
{
"resourceName": "people/117200475532672775346",
"etag": "%EgQBBzcuGgwBAgMEBQYHCAkKCwwiDDQwaGhWYzc3cXJBPQ==",
"birthdays": [
{
"metadata": {
"primary": true,
"source": {
"type": "PROFILE",
"id": "117200475532672775346"
}
},
"date": {
"month": 1,
"day": 6
}
},
{
"metadata": {
"source": {
"type": "ACCOUNT",
"id": "117200475532672775346"
}
},
"date": {
"year": 1971,
"month": 1,
"day": 6
}
}
]
Normally you will only get birthdays that have public visibility. To get private birthdays you need to use the https://www.googleapis.com/auth/user.birthday.read scope. See documentation for which scopes give you which data https://developers.google.com/people/v1/how-tos/authorizing#profile-scopes.
I want to access the Person's gender and age group via Google People API. Can we fetch the information without getting the user signed in from our app?
That depends interlay upon what they have set to public. You can use people.get with a public api key. All you need is the API key from the Google Developer console and the Id of the person in question.
110241806600768156114
The Request
GET https://www.googleapis.com/plus/v1/people/110241806600768156114?key={YOUR_API_KEY}
Response
{
"kind": "plus#person",
"etag": "\"RqKWnRU4WW46-6W3rWhLR9iFZQM/uQPoHyS74SJW3R-WzeaqLgt_EL8\"",
"gender": "male",
"objectType": "person",
"id": "110241806600768156114",
"displayName": "djordje tankosic",
"name": {
"familyName": "tankosic",
"givenName": "djordje"
},
"url": "https://plus.google.com/110241806600768156114",
"image": {
"url": "https://lh6.googleusercontent.com/-XtK8-6zkQHY/AAAAAAAAAAI/AAAAAAAAAJk/hI2NqHzmNrA/photo.jpg?sz=50",
"isDefault": false
},
"isPlusUser": true,
"circledByCount": 18,
"verified": false
}
This person who I just randomly grabbed there Id off Google+ has gender set to public. As you can see there is not much other information available to you.
I suggest you go to the bottom of the people.get page and do some testing with the try me don't authenticate it. This will ensure that you are only checking public access. If you want to see the different authenticate it then use 'me' in the id field. This will show you the response for an authenticated user.
I am integrating Instagram in my android app. I am able to get authetication and token from Instagram API. Now what I am looking for is userinfo. As soon as user is authenticated I want his userinfo like username,name etc. Any idea how to get it ? I tried several ways but didnt able to achieve it.
I tried this example https://github.com/poller/instagram-demo-for-android
Get basic information about a user. To get information about the owner of the access token, you can use self instead of the user-id.
Link for Documentation is :
https://instagram.com/developer/endpoints/users/
Use this API :
https://api.instagram.com/v1/users/{user-id}/?access_token=ACCESS-TOKEN
Response contains information about that particular user requested by passing ID :
{
"data": {
"id": "1574083",
"username": "snoopdogg",
"full_name": "Snoop Dogg",
"profile_picture": "url of picture",
"bio": "This is my bio",
"website": "website of that user",
"counts": {
"media": 1320,
"follows": 420,
"followed_by": 3410
}
}
Simply pass your access token to this url. And you will get the logged user information of the Instagram.
[https://api.instagram.com/v1/users/self/?access_token=YOUR-ACCESS-TOKEN]
this will return the user information like the above #Heena Arora mentioned.
And also she mentioned about retrieving the user information for the particular user by id.