Last Updated: 6/15/2022, 1:51:10 AM

# Profile

# Overview

Profile services allow players to display information about themselves such as their Name, Location, Date of Birth, and Photos. Beyond these basic attributes, you can also create your own attributes to customize the player profiles for your game. For example, you can add attributes that include a player’s level or rank. When you add these attributes to the Profile service, that information will be displayed on each player’s profile.

# Custom Attributes

Custom Attributes can be implemented using the SDK. In the sample code below four custom attributes have been added: level, rank, equipped sword, and equipped shield. When this code is implemented, these attributes will appear in each player’s profile.

{  
 "userId": "string",  
 "namespace": "string",  
 "firstName": "string",  
 "lastName": "string",  
 "avatarSmallUrl": "string",  
 "avatarUrl": "string",  
 "avatarLargeUrl": "string",  
 "status": "ACTIVE",  
 "language": "string",  
 "timeZone": "string",  
 "dateOfBirth": "2019-12-22",  
 "customAttributes": {  
 "level": "1",  
 "rank": "Grand Master",  
 "activeWeapon": "Copper Sword",  
 "activeShield": "Pot Lid"  
 }  
}  

# Tutorials

# Basic Profile

# Create a Player Profile

To create a player profile, you can use the following function.

# Retrieve a Player’s Profile

You can retrieve a player profile using the following function. This function will retrieve the player’s personal information, such as First Name, Last Name, Language, etc. Check the Get My Profile Info (opens new window) endpoint to learn more about the output.

# Retrieve a Player’s Public Profile

If you need to get a player's public profile, you can use the following function. The public profile is the profile that other players see when interacting in the game. When retrieving a player’s public profile you will receive the player’s User ID, Namespace, Timezone, and Avatar URL.

# Update a Player Profile

Use the following function to update a player profile.

# Custom Attributes

# Create Custom Attributes

Custom attributes are parts of a UserProfile that are unique to a particular game, such as weapon type. You can create custom attributes when creating a UserProfile.

# Update Custom Attributes

The following function can be used to update a specific custom attribute field.

You can also update multiple fields that have the desired value using the following function.

# Retrieve Custom Attributes

You can retrieve a player profile with its custom attributes using the following function.

# Connecting Custom Services to Basic using the Server SDK

# SDK Initialization

Before using the Basic service (which includes the Profile service) from the SDK, you will need to initialize your server-side SDK to make you authorized and able to perform create, read, update, and delete actions.

# Golang SDK Initialization

Before using the Basic service from the Golang SDK, you will need to initialize the SDK by following the steps below:

Once completed, you can use the Golang SDK to create, read, update, or delete Basic (opens new window) service from your serverless app.

# Python SDK Initialization

Before using the Basic service from the Python SDK, you will need to initialize the SDK by following the steps below:

Once completed, you can use the Python SDK to create, read, update, or delete Basic (opens new window) service from your serverless app.

# .NET (C#) SDK Initialization

Before using the Basic service, you will need to set some permissions. Use the following .NET namespaces:

using AccelByte.Sdk.Api.Basic.Model;
using AccelByte.Sdk.Api.Basic.Operation;
using AccelByte.Sdk.Api.Basic.Wrapper;

# Java SDK Initialization

Before using the Basic service, you will need to set some permissions. Initialize the UserProfile wrapper from the Basic service using the following code:

UserProfile wProfile = new UserProfile(sdk);

Once completed, you can use the SDK to create, read, update, or delete player profiles.

# Create a Player Profile

Use the following function to create a player profile (opens new window):

# Delete a Player Profile

Use the following function to delete a player profile (opens new window):

# Retrieve a Public Profile

Use the following function to retrieve a public profile (opens new window):

# Update a Player Profile

Use the following function to update a player profile (opens new window):