Skip to content

Common Use Examples

Justin Skiles edited this page Apr 16, 2020 · 6 revisions

Get a Player's Steam Profile

var steamUserInterface = webInterfaceFactory.CreateSteamWebInterface<SteamUser>();
var playerSummaryResponse = await steamInterface.GetPlayerSummaryAsync(<steamIdHere>);
var playerSummaryData = playerSummaryResponse.Data;

Here is an example response serialized to JSON. Note that some of these properties depend on your Steam profile being public.

{
  "SteamId": 76561197960361544,
  "ProfileVisibility": 3,
  "ProfileState": 1,
  "Nickname": "aro",
  "LastLoggedOffDate": "2020-04-16T02:03:11",
  "CommentPermission": 1,
  "ProfileUrl": "https://steamcommunity.com/id/aro/",
  "AvatarUrl": "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/a9/a9e5bf672bb4c7837b9fbec8a76bc1184fb3b99f.jpg",
  "AvatarMediumUrl": "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/a9/a9e5bf672bb4c7837b9fbec8a76bc1184fb3b99f_medium.jpg",
  "AvatarFullUrl": "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/a9/a9e5bf672bb4c7837b9fbec8a76bc1184fb3b99f_full.jpg",
  "UserStatus": 1,
  "RealName": null,
  "PrimaryGroupId": "103582791435784710",
  "AccountCreatedDate": "2003-09-12T14:47:23",
  "CountryCode": null,
  "StateCode": null,
  "CityCode": 0,
  "PlayingGameName": null,
  "PlayingGameId": null
}

Get a Player's Friends List

var steamUserInterface = webInterfaceFactory.CreateSteamWebInterface<SteamUser>();
var friendListResponse = await steamUserInterface.GetFriendsListAsync(76561197960361544);
var friendList = friendListResponse.Data;

Here is an example response serialized to JSON. Note that this will return a 401 Unauthorized if the player's profile is private.

[
  {
    "SteamId": 76561197960461463,
    "Relationship": "friend",
    "FriendSince": "1970-01-01T00:00:00"
  },
  {
    "SteamId": 76561197960503439,
    "Relationship": "friend",
    "FriendSince": "2014-08-17T02:52:46"
  },
  {
    "SteamId": 76561197960511559,
    "Relationship": "friend",
    "FriendSince": "1970-01-01T00:00:00"
  }
]
Clone this wiki locally