How to get information about logged in user by google plus api? - google-plus

I am using the Google Plus API to get information about the logged in user. I wrote the following URL:
https://www.googleapis.com/plus/v1/people/114518101688116406504?key=AIzaSyCedmALgpuHY1FjfwKBg6LOeo-OxCxgPKc
But with this link, I am only able to access the user with id="114518101688116406504". I want information for the current logged in user.
For example, in Facebook's API we write /me.
What parameter should I include in my URL so that I can access the current logged in user's information?

You can use the special id of me instead of the userid for this as well. See https://developers.google.com/+/api/latest/people/get for further details.

Related

Using Instagram's Graph API, how can I retrieve post data (media url, caption, poster username, etc)

I want to use Instagram's Graph API on my backend server to retrieve data about an Instagram post. On my frontend, users will submit a post URL (like https://www.instagram.com/p/CAvPIm2lszQ/). Then on my backend, I want to take the ID of the post from that URL (so in this case CAvPIm2lszQ) and then I'm hoping that I can pass that ID thru the Instagram Graph API and then retrieve the data that I need (media URL, caption, poster username, etc.).
So would that be possible? I did find documentation on "IG Media" for the Graph API, but under permissions, it says, "A Facebook User access token from a User who created the IG Media object, with the following permissions.."
Unless I'm misunderstanding it, I'm not sure if I'll be able to access posts from various public accounts. I think it's also worth mentioning that my users are not logging into their Instagram accounts to use my service so the only possible "User access token" would be my own.
Any ideas on how I can go about this? I was using the instagram.com/p/{post_id}/?__a=1 endpoint to meet my needs before but it doesn't work on my production server for some reason. So I'm kinda stuck.
Most probably you will not be able to achieve that using Instagram API. First of all the ID you are referring to CAvPIm2lszQ is not the ID that you will use for getting IG Media. The ID is different (it's numeric value like in the sample request from the page you've linked). The full URL that includes CAvPIm2lszQ is in the shortcode field.
At the moment it is not possible to look for the post detail using shortcode. If you want to use that endpoint you need to get the real post ID first, for instance by listing list of posts from given user.
But in order to do so - you need to use Facebook login authorization window to get token from given user. Alternatively you can try to request https://developers.facebook.com/docs/instagram-api/guides/business-discovery but it requires going through App review and having your own company to pass the Business Verification. Keep in mind that this endpoint returns information only about Instagram Professional accounts (Business/Creator account). You will not be able to get information about regular accounts.
And the last thing about ?__a=1 endpoint. This is not the official Instagram API. They use it only for their own purposes. Most probably your server IP address has been blocked due to sending too many requests.

Get current logged in user info (email or userid) from google fit API

I am integrating google fit APIs for tracking fitness activities and I need to display logged in user email, but I am not able to fetch user info like email or userid from google fit.
I have found https://developers.google.com/fit/rest/v1/reference/users/dataSources/get but I need to add userId and dataSourceId in request parameters which I am unable to find.
You are looking at the wrong place.
The data you are looking for is under: People API v1.
Use the following scopes for oAuth:
https://www.googleapis.com/auth/userinfo.profile,
https://www.googleapis.com/auth/userinfo.email
Following url to fetch data:
https://people.googleapis.com/v1/people/me
A get call with access_token should be good for you. Enjoy :)

Load instagram images from user's feed via API

I am trying to display only the images the client uploaded to instagram on their website. The client's user ID# is 176722013. According to the API this URL will provide just such a feed:
https://api.instagram.com/v1/users/176722013/media/recent
As indicated by the error message, I need to provide either a client_id or an auth_token. Since I don't want to deal with authentication I went ahead and created an "app" in instagram developers to get a client_id # 5b5a6e95469f465f9f70e4ebcf9ee3a6
Yet when I add it to the URL I still get an error that I needed to provide an auth_token. How does that make sense?
https://api.instagram.com/v1/users/176722013/media/recent?client_id=5b5a6e95469f465f9f70e4ebcf9ee3a6
The app is in sandbox mode. When I attempt to submit it for review I must provide the purpose for the app. Upon selecting " I want to display my Instagram posts on my website." as the purpose I get the following message:
You do not need to submit for review for this use case. If you are a
developer and you want to display Instagram content on your website,
then you do not need to submit your app for review. By using a client
in sandbox mode, you can still access the last 20 media of any sandbox
user that grants you permission.
I am truly at a loss for how to proceed. Thanks for any support
As of June 1st, 2016, you need access_token to access API, where did u read: either a client_id or an auth_token ?
authenticate and get access_token and use to get API response.
#snucky you don't need authentication but you do need the users permission - from what I gather, instagram is accessible only by registered users - so you still need the access token - but instead of a server-explicit you need client-implicit.
Make a http request from your client to the api/authorize with the ?client_id=ID AND A redirect_uri=http://yoursite.com/ when the user allows the application, you'll receive an access_token in the url, which you will then use in every subsquent instagram call
read more here

Pinterest api - Get user detail

I want to fetch user detail of pinterest's logged in user.
Currently, I am able to to login through api and I get access token also.
Now I want to get that user's detail.
I tried to search for it but not a luck.
Note : I want to fetch that user's pin so I am using below api.
https://api.pinterest.com/v3/pidgets/users/(USERNAME)/pins/?access_token=ACCESSTOKEN
For this I want (USERNAME).
https://api.pinterest.com/v2/me?access_token=YOUR_ACCESS_TOKEN
returns the user data
{“username”: “Name”,
“image_url”: “http://d30opm7hsgivgh.cloudfront.net/avatars/image.jpg”,
“full_name”: “xyz abc”,
}
call this API and get users Details

Getting the share link for checkins from Foursquare API

Currently I'm grabbing a user's latest checkin and displaying it on a page. This is done using an access token, e.g.
var url = "https://api.foursquare.com/v2/users/self/checkins?oauth_token=" + access_token + "&v=20120214";
What I'm trying to do is have a link go to the check in URL on Foursquare, however that link asks for users to log in. The link is created like so:
foursquare.com/{username}/checkin/{checkinID}
This goes to a "log in to foursquare" page, but if I view the link for Twitter, it has an extra parameter, "s=", which shows the check in regardless of being logged into Foursquare or not.
So my question is how can I generate a share link for the check in? I can't find anything in the docs about having a signature, nor is it something I find in the checkin object.
Check-ins are only visible to a user's friends, unless they choose to publish it to another system like Twitter or Facebook. Because of this, a potential viewer needs to log-in so we can verify that they are a friend of the user.