Fetch Unfollower Instagram api swift - ios

Can i fetch details of unfollower of Instagram user using instagram api?
If it's possible then how can i do it????
I used relationship endpoint to do it
https://api.instagram.com/v1/users/{user-id}/relationship?access_token=ACCESS-TOKEN
let newJson1 = JSON(data: NSData(contentsOfURL: NSURL(string: "https://api.instagram.com/v1/users/\(self.id)/relationship?access_token=\(self.accessToken)")!)!, options: NSJSONReadingOptions.AllowFragments, error: nil)
print(newJson1)
but none of the results found....
Do you have some advices? Thanks

#John Instagram limits the api access. For that you have to approve your app permission from the sandbox. Once the Instagram approves your permission, then you can access of the relevant data. Approving permission can be done by submitting your app to Instagram.

Related

How to get followers list from Twitter?

I am trying to call following Twitter's API to get a list of followers for a user.
http://api.twitter.com/1.1/followers/ids.json?cursor=-1&screen_name=username
And I am getting this error message in response.
{
code = 215;
message = "Bad Authentication data";
}
I can't seem to find the documentation related to this error code. Anyone has any idea about this error?
Your request lacks authentication data. I got that error when I simply clicked on http://api.twitter.com/1.1/followers/ids.json?cursor=-1&screen_name=username. This is not the way to access twitter API.
Create a Twitter app from https://apps.twitter.com/. Then, try using a Twitter API Library to access REST API. If you are comfortable with using ruby apps on command line interface check out https://github.com/sferik/t. Set it up and then try t followers [USER] for listing all followers of USER.
You will have to use OAuth. More info can be found on Twitter website. Here: https://dev.twitter.com/oauth
This error is coming because your Twitter developers account is not approved. Now-a-days you can't make app without getting your developers account approved from Twitter.
To make an app, you need to contact Twitter and apply for developers account. If you are lucky engough, you will get approval although this process may take months.
If you just need the data, go for third party services like followersanalysis[dot]com, birdsonganalytics[dot]com

How to fetch google contacts into an iOS application

I read the below link and now I understood that I need to make an api call to fetch the contacts. As I am new to Swift3 could someone guide me how to do this. I read somewhere that Almofire and Swifty json would help and I also read GData also will help. I am little confused. Please guide me.
Google Contacts API
You might want to try Google Sign-In for iOS, get users into your apps quickly and securely, using a registration system they already use and trust—their Google account. This Google Sign-in videos - series #1, series #2 and series #3 will help you understand the implementation of Google SignIn in iOS, how do you use Google Sign in on iOS with another service like Google Drive? and more.
Here are some tutorials and reference that can help:
Integrate Google Signin SDK In iOS Application Using Swift
How to Integrate Google Sign In into Your iOS Apps
Requesting additional scopes after sign-in
Invite friends from Gmail (This tutorial use a gmail contact scope rather than the google plus contacts) PS. not an iOS tutorial
Lastly here are some related SO question for refrence - How to fetch gmail Contacts in iOS application using google contacts api? and Get Google contacts using API on iOS
Hope this helps.
I was actually stuck on this too and couldn't find a solution but I ended up figuring it out. You first need to authenticate with Google Sign In and then pass the accessToken into this endpoint:
let urlString = ("https://www.google.com/m8/feeds/contacts/default/full?alt=json&max-results=5000&access_token=\(GIDSignIn.sharedInstance().currentUser.authentication.accessToken!)")
guard let url = URL(string: urlString) else { return }
URLSession.shared.dataTask(with: url, completionHandler: {
(data, response, error) in
if(error != nil){
print("error")
}else{
do{
let json = try JSONSerialization.jsonObject(with: data!, options:[]) as! [String : AnyObject]
//parse JSON
}catch let error as NSError{
print(error)
}
}
}).resume()

Google Signin for iOS - YouTube Channel ID

I have follows the instructions and implement Google Signin for iOS in test application.
After getting the user profile & token, I want to get the user YouTube channel ID.
I have tried to use the user access token with the following URL but I got exception of "Insufficient Permission"
https://www.googleapis.com/youtube/v3/subscriptions?part=snippet&maxResults=50&mine=true&access_token={oauth_token}
How can I do this in Swift?
Google Signin for iOS implementation which allow you yo signin with your google account. In order to have that ability to get YouTube data it require additional scope configuration as follows:
let scope: NSString = "https://www.googleapis.com/auth/youtube.readonly"
let currentScopes: NSArray = GIDSignIn.sharedInstance().scopes
GIDSignIn.sharedInstance().scopes = currentScopes.arrayByAddingObject(scope)
Now, you can run the following YouTube data API with Access Token:
https://www.googleapis.com/youtube/v3/channels?part=id&mine=true&access_token={oauth_token}
The access token, you will get from user.authentication.accessToken

Authentication with Twitter using the Twitter access token on Azure (using iOS Twitter reverse Auth)

I'm currently working on an iOS app which will (if I can figure out this problem) use Azure as backend. The user is supposed to login with their iOS account which they already setup on their iOS device. I than use reverse authentication (https://dev.twitter.com/docs/ios/using-reverse-auth) to get the user's access token and I would like to use said access token to login the user.
I tried using (Swift snippet)
let tokenDictionary = ["access_token": "<token-I-got>"];
client.loginWithProvider("twitter", token: tokenDictionary.bridgeToObjectiveC(), completion: {(user: MSUser!, error: NSError?) in
if let user = user? {
print(user.userId)
} else if let error = error? {
print(error)
}
})
but the only thing the API returns is:
POST of Twitter token is not supported.
Any ideas how I could get this to work or do I have to switch away from Azure to something different? (And using the webview for login is not an option, as we have this nice already accounts on iOS already setup with the credentials).
Thanks for helping.
This feature is not currently supported by Azure Mobile Services. You can upvote the feature request here.

Getting an invalid_scope for youtube.upload device code request

I am trying to use the Youtube data API from an app, and I'd like to just request permission to upload videos, not to manage their entire Youtube account.
When I try to request an access token for the scope https://www.googleapis.com/auth/youtube.upload, I get back an error saying it is an invalid scope. I've given the app permission to the Youtube v3 data API.
According to the v3 youtube docs, these are the supported scopes:
https://www.googleapis.com/auth/youtube - Manage your YouTube account.
https://www.googleapis.com/auth/youtube.readonly - View your YouTube account.
https://www.googleapis.com/auth/youtube.upload - Upload YouTube videos and manage your YouTube videos.
The only one of these 3 that works for me is "https://www.googleapis.com/auth/youtube".
This is the request I am attempting:
curl -d "client_id=id&scope=https://www.googleapis.com/auth/youtube.upload" https://accounts.google.com/o/oauth2/device/code
And this is the response:
{
"error" : "invalid_scope",
"error_description" : "Not authorized to request the scopes: [https://www.googleapis.com/auth/youtube.upload]",
"error_uri" : "http://code.google.com/apis/accounts/docs/OAuth2.html"
}
I am thinking that maybe this type of request just doesn't work for device codes? The youtube.upload scope request seems to work fine in the oauth2 playground.
Update: This issue has been fixed.
This scope by itself was not whitelisted for the devices. Filed a request internally.
On the other hand, as explained here, Stackoverflow is for programming questions, you can use public issue tracker for bug reports or feature requests.
Feel free to file a bug report in issue tracker to get updated on this issue.

Resources