Reputation: 2189
i have used oauth mechanism to let the user login via twitter in my app, on successful login it returns me the access taken, username and oauth_token_secret, i want to get the user account information from twitter like his location, date of birth, and other profile information. I have searched the Rest Api given on the twitter's official site but haven't found any such link.... so how to get the user 's account information? kindly help me.
Upvotes: 3
Views: 5863
Reputation: 158
Twitter-Kit Version 3.4.0 Here is function
-(void)userVerify:(NSString *)userID{
NSString *statusesShowEndpoint = @"https://api.twitter.com/1.1/users/show.json";
NSDictionary *params = @{@"id": userID};
NSError *clientError;
// Objective-C
TWTRAPIClient *client = [[TWTRAPIClient alloc] init];
NSURLRequest *request = [client URLRequestWithMethod:@"GET" URLString:statusesShowEndpoint parameters:params error:&clientError];
if (request) {
[client
sendTwitterRequest:request
completion:^(NSURLResponse *response,
NSData *data,
NSError *connectionError) {
if (data) {
// handle the response data e.g.
NSError *jsonError;
NSDictionary *json = [NSJSONSerialization
JSONObjectWithData:data
options:0
error:&jsonError];
NSLog(@"%@",[json description]);
self.txtViewDetails.text = [json description];
}
else {
NSLog(@"Error code: %ld | Error description: %@", (long)[connectionError code], [connectionError localizedDescription]);
self.txtViewDetails.text = [NSString stringWithFormat:@"Error code: %ld | Error description: %@", (long)[connectionError code], [connectionError localizedDescription]];
}
}];
}
else {
NSLog(@"Error: %@", clientError);
}
}
Upvotes: 0
Reputation: 43919
what about this call
https://api.twitter.com/1/users/show.json?screen_name=TwitterAPI&include_entities=true
Upvotes: 3