Instagram Get information about a user

GetUser

The Users endpoint exposes a GetUser that lets you get information about a given user based on their user ID.

It is not possible to get information about a user based on their username directly, so you will instead have to search for their username, and then get the user ID from the search results.

The GetUser method will return an object representing the entire HTTP response from the API, so have a look at the example on how to get the information of the user.

// Make the call to the API
InstagramUserResponse response = service.Users.GetUser(189413627);

// Get the user object (the "Data" property matches the JSON)
InstagramUser user = response.Body.Data;

// Write the name and ID to the console
string displayName = user.FullName ?? user.Username;
Console.WriteLine(displayName + " (" + user.Id + ")");

GetSelf

If your service has a user context, you can also use the GetSelf method to get information about the authenticated user.

// Make the call to the API
InstagramUserResponse response = service.Users.GetSelf();

// Get the user object (the "Data" property matches the JSON)
InstagramUser user = response.Body.Data;

// Write the name and ID to the console
string displayName = user.FullName ?? user.Username;
Console.WriteLine(displayName + " (" + user.Id + ")");

Both calls will return an instance of InstagramUserResponse. As you can see in the example above, this class will expose information about the user through the InstagramUser class.