User.GetUserFromId Function In ver. 0.9

Feb 22, 2014 at 9:37 AM
Hi,

I am getting null value from User.GetUSerFromId function %90 percent of requests.

var credentials = TwitterCredentials.CreateCredentials(ACCESS_TOKEN, ACCESS_TOKEN_SECRET, consumerKey, consumerSecret);
TwitterCredentials.Credentials = credentials;
long userId = long.Parse(USER_ID);
user = User.GetUserFromId(userId);

How can I solve this issue?

Thanks for answers.

Kind regards.
Coordinator
Feb 22, 2014 at 11:37 AM
Hi there,

If I understand correctly you are successfully getting some users but you are failing to get others.
Would you please give me a USER_ID that returned null so that I can analyze the issue.

Kind Regards,
Linvi
Feb 22, 2014 at 11:58 AM
Edited Feb 22, 2014 at 12:02 PM
Hi Linvi,

Not exactly. There is no specific user id. For example for this user id 491688991 i got null value from GetUserFromId for first 9 function call but tenth call was successfully return IUser object. May be function call frequency (1 second) cause this situation, I am not sure.

Kind regards,

By the way very good work. Its very usefull and simple :) Congrats.. :)

Edit : This user id 1148849347 can example for this issue. I called 25 times GetUserFromId function for this ID 1148849347 but every time return null.
Coordinator
Feb 22, 2014 at 12:08 PM
Hi,

I didn't get any issue with the following code:
List<IUser> users = new List<IUser>();

for (int i = 0; i < 10; ++i)
{
         users.Add(User.GetUserFromId(491688991));
         Thread.Sleep(1000);
}
Can you check the issue that occurred:
var lastException = ExceptionHandler.GetLastException();
And Send me the details please.

Linvi
Feb 22, 2014 at 2:13 PM
Hi Linvi,

Here is the my error details.

Not related with topic but I added these details to,

Function : .UnFollowUser
Link : https://api.twitter.com/1.1/friendships/destroy.json?user_id=2244894897
Error Message : Internal Server Error - Something is broken. Please post to the group so the Twitter team can investigate.

Function : .FollowUser
Link : https://api.twitter.com/1.1/friendships/create.json?user_id=1110231607
Error Message : Internal Server Error - Something is broken. Please post to the group so the Twitter team can investigate.

Link : https://api.twitter.com/1.1/friendships/create.json?user_id=1613608830
Error Message : Forbidden - The request is understood, but it has been refused or access is not allowed. An accompanying error message will explain why. This code is used when requests are being denied due to update limits.

Note : I think this one only limitation error.

Function : User.GetUserFromId
StatusCode : 404
Link : https://api.twitter.com/1.1/users/show.json?user_id=336626513
Error Message : Not Found - The URI requested is invalid or the resource requested, such as a user, does not exists. Also returned when the requested format is not supported by the requested method.

Note : But this user id (336626513) coming from my followers list.

Same error for these user ids

https://api.twitter.com/1.1/users/show.json?user_id=151056645
https://api.twitter.com/1.1/users/show.json?user_id=223386482
https://api.twitter.com/1.1/users/show.json?user_id=226056785
Coordinator
Feb 22, 2014 at 6:26 PM
Hi there,

Error 1 & 2

Error Message : Internal Server Error - Something is broken. Please post to the group so the Twitter team can investigate.
This message informs you that Twitter is currently experiencing issues and made you request failed.

Error 3

Error Message : Forbidden - The request is understood, but it has been refused or access is not allowed. An accompanying error message will explain why. This code is used when requests are being denied due to update limits.
Usually when I see this message it is often related with credentials. Please verify your credentials and the application contains all the required authorizations.
Few days ago Twitter reset some of the user credentials so please verify this.

You also need to verify your rate limits. If you are attempting to perform the same request for multiple users you might find yourself facing rate limit issues.
You can get your rate limits with this code:
var rateLimits = RateLimit.GetCurrentCredentialsRateLimits();
Console.WriteLine(rateLimits.FriendshipsOutgoingLimit.Remaining);

Error 4

https://api.twitter.com/1.1/users/show.json?user_id=336626513
I cannot really explain this one. I have verified and there is no user with this id so I do not understand why you received this Id in your Followers, maybe the account has been removed, I honestly don't know.

As these issues are not "common" I will be happy to give you more information if you provide me your code.
Please keep me up to date.
Linvi
Marked as answer by linvi on 3/15/2014 at 7:28 PM