Get userInfo from Instagram in android - android

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.

Related

not able to pass ofl parameter in request body in REST api of firebase dynamic link?

I am using firebase dynamic links where i used their REST api to create dynamic link. I am able to create the short link by using REST api and created link is working fine on android and ios app as well as on mobile browser. But i used same link on desktop browser it is not redirecting to play store page. Firebase provided "ofl" as a parameter to provide my intended functionality but there is no documentation to how i can pass that parameter in request body. Can anyone help me out ?
{
"dynamicLinkInfo": {
"domainUriPrefix": "my_custome_domain_name",
"link": "my_dynamic_link",
"androidInfo": {
"androidPackageName": "my_package_name",
"androidFallbackLink": "https://play.google.com/store/apps/details?id=my_package_name",
"androidMinPackageVersionCode": "2"
}
"navigationInfo": {
"enableForcedRedirect": true,
}
},
"suffix": {
"option":"UNGUESSABLE"
}
}
As far as I know, ofl is used to specify a different behavior on desktop, Like to display your webpage which gives brief info about your app or to display a link which can redirect to play store.... In your case you directly want to redirect to play store, so for that you can use desktopFallbackLink and provide your play store link of app
eg:
{
"dynamicLinkInfo":{
"domainUriPrefix":"my_custome_domain_name",
"link":"my_dynamic_link",
"androidInfo":{
"androidPackageName":"my_package_name",
"androidFallbackLink":"https://play.google.com/store/apps/details?id=my_package_name",
"androidMinPackageVersionCode":"2"
},
"navigationInfo":{
"enableForcedRedirect":true,
}
},
"suffix":{
"option":"UNGUESSABLE"
},
"desktopInfo":{
"desktopFallbackLink":"https://www.other-example.com/"
}
}

How to get all the posts of a facebook page?

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.

Hotel Reservation (LodgingReservation) card not showing in Google Now

I've been trying to integrate a Google schema (LodgingReservation schema) in my company's hotel booking confirmation e-mails, in order to make corresponding hotel reservation cards appear in Google Now/Google Search, as specified in the following Google documentation :
https://developers.google.com/gmail/markup/reference/hotel-reservation
I've sent a test e-mail containing the JSON markup multiple times to my Gmail account, opened the e-mail, then refreshed my Google Now app's feed multiple times, but no Reservation Card showing there.
I do get some other types of cards, such as local weather info, event reminders from my calendar, etc. I checked the settings on my Google account and Android phone multiple times, tried to use different accounts and phones from my colleagues, but it won't show ANYWHERE.
HOWEVER :
Viewing the source from the e-mail, I was able to confirm that the expected markup was there, and even managed to validate it using the following Google tool : https://www.google.com/webmasters/markup-tester/
Using my Google account, I'm able to see that my Google Card history contains a "travel" type card, supposedly received today, and that appears on every phone/Google account I've tested, a few seconds after the booking confirmation e-mail was sent
Based on those informations, I assume the card is recognized somehow by my account, but I don't get why it wouldn't show in the gNow feed ...
Would someone have an idea about that ?
Here is the markup I've sent in the e-mail :
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "LodgingReservation",
"reservationNumber": "872914",
"reservationStatus": "http://schema.org/Confirmed",
"underName": {
"#type": "Person",
"name": "Max Mustermann"
},
"reservationFor": {
"#type": "LodgingBusiness",
"name": "Verkaufshotel Blaue Linde",
"address": {
"#type": "PostalAddress",
"streetAddress": "Industriestra&#223;e 27",
"addressLocality": "Offenburg",
"addressRegion": "Ortenau",
"postalCode": "77656",
"addressCountry": "Deutschland"
},
"telephone": "+49 781 310 55 0"
},
"checkinDate": "2015-11-20T11:00:00-08:00",
"checkoutDate": "2015-11-23T11:00:00-08:00"
}
</script>
#Joffrey Quillet I've tested your markup and was able to generate a Now card, however, I did change the checkinDate and checkoutDate during my test:
"checkinDate": "2015-11-23T13:30:00-08:00",
"checkoutDate": "2015-11-24T11:00:00-08:00"
I have a feeling you're located in a area that doesn't support hotel reservation cards. Per this documentation, "Even if you can turn on Google Now in your country, you might not see every type of Now card."
Here is my result using your markup example:

Can we access Google Person api without signing in through our app in Android?

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.

Why getting the FB profile picture using graph API needs access token?

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
}
}

Categories

Resources