Tutorial: Get a user profile by ID
This tutorial shows how to load one user profile with GetUserByIdAsync and handle common API errors.
Example
using LuduvoDotNet;
var client = new Luduvo();
try
{
var user = await client.GetUserByIdAsync(2);
Console.WriteLine($"ID: {user.UserId}");
Console.WriteLine($"Username: {user.Username}");
Console.WriteLine($"Display name: {user.DisplayName}");
Console.WriteLine($"Friends: {user.FriendCount}");
}
catch (UserNotFoundException)
{
Console.WriteLine("User was not found.");
}
catch (TooManyRequestsException)
{
Console.WriteLine("Rate limit reached. Try again later.");
}
Notes
GetUserByIdAsynccalls/users/{userId}/profile.UserNotFoundExceptionis thrown for404responses.TooManyRequestsExceptionis thrown for429responses.