Skip to main content

Store restricted player and game data in admin records

Last updated on October 24, 2024

Overview

This article walks you through how to:

  • Access admin records in the AccelByte Gaming Services (AGS) Admin Portal.
  • Create, modify, retrieve, and delete admin records.

Prerequisites

You will need access to:

Manage admin records in the Admin Portal

Access the Admin Records page

  1. On the Admin Portal sidebar, go to Progression & Inventory > Cloud Save > Admin Records.

  2. On the Admin Records page, depending on the record type you want to view, open the Game Records or the Player Records tab.

    Admin Records Management

Create a new admin record

To create a new admin record to store player or game data, follow these steps:

  1. On the Admin Portal sidebar, go to Progression & Inventory > Cloud Save > Admin Records.

  2. On the Admin Records page, depending on the record type, open the Game Records or the Player Records tab. Then, click on the + Add record button.

    • Admin Game Records: The data will not be associated with a specific user ID and can be used to store game-wide data but only an admin and a game server can access it.
    • Admin Player Records: The data will be associated with a specific user ID and can be used to store specific user data but only the admin and a game server can access it.
  3. On the Add Record form, fill in the required information:

    • Game Records

      • Key: add the Game Record key. This is the identifier of the record.

      • JSON Configuration: add the data you want to store in JSON format.

        Image shows the Add Record form

    • Player Records

      • User ID: add the user ID of the user that will be associated with the record.

      • Key: add the Player Record key. This is the identifier of the record.

      • JSON Configuration: add the data you want to store in JSON format.

        Image shows the Player Records form

  4. Click Add to create the record. The new record will be added to the list.

Modify admin records

The AGS Admin Portal allows you to modify admin records if you want to take manual action with the data, such as fixing data, auditing, etc.

To modify an admin record, follow these steps:

  1. On the Admin Portal sidebar, go to Progression & Inventory > Cloud Save > Admin Records.

  2. On the Admin Records page, depending on the record type, open the Game Records or the Player Records tab.

    • For game records, find the record you want to modify from the list or use the search option to search for records using the game record key. Click on the record's View button under the Action menu to open its details page.

      Image shows the View button of a record

    • For player records, search for the record using the player's email or username. Click on the record's View button under the Action menu to open its details page.

      Image shows the search box for player records

  3. On the details page of the record, click on the pencil or edit icon of the fields or sections to update the content.

    Image shows the Edit button on the Record Detail page

  4. Save your changes.

Delete admin records

The AGS Admin Portal allows you to delete admin records if you want to delete records as necessary.

To delete an admin record, follow these steps:

  1. On the Admin Portal sidebar, go to Progression & Inventory > Cloud Save > Admin Records.

  2. On the Admin Records page, depending on the record type, open the Game Records or the Player Records tab.

    • For game records, find the record you want to modify from the list or use the search option to search for records using the game record key. Click on the record's Delete button under the Action menu. A confirmation message appears.

      Image shows the Delete button for records

    • For player records, search for the record using the player's email or username. Click on the record's Delete button under the Action menu. A confirmation message appears.

      Image shows the Edit button on the Record Detail page

  3. Click Delete on the confirmation message. The record is immediately deleted from the records list.

    Image shows the Delete Record pop-up

Manage admin records with the Server SDK

With the Server SDK, you can:

  • Create new admin records to store player or game data
  • Retrieve admin records
  • Modify admin records
  • Delete admin records

Create new admin records to store player or game data via Game Server

You can create admin records that are dynamically created after some actions are triggered from the Game Server. This function can be used to store additional match information, which is restricted for the player and can be used by the Game Server for the next match.

You can create a new record and store the data through the following methods:

Create admin game records

Unreal Engine

FServerApiClientPtr ServerApiClient = FMultiRegistry::GetServerApiClient();

FString Key = "SomeCloudSaveKey";

FJsonObject DataJson;
const FString gameId = FGuid::NewGuid().ToString();
DataJson.SetStringField("gameId", gameId);
DataJson.SetStringField("region", TEXT("ID"));
DataJson.SetStringField("language", TEXT("en"));

ServerApiClient->ServerCloudSave.SaveGameRecord(Key
, DataJson
, FVoidHandler::CreateLambda([]()
{
// Do something if SaveGameRecord is successful
})
, FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if SaveGameRecord has an error
}));

Create a temporary admin game records

Unreal Engine

FServerApiClientPtr ServerApiClient = FMultiRegistry::GetServerApiClient();

FString Key = "SomeCloudSaveKey";

FJsonObject DataJson;
const FString gameId = FGuid::NewGuid().ToString();
DataJson.SetStringField("gameId", gameId);
DataJson.SetStringField("region", TEXT("ID"));
DataJson.SetStringField("language", TEXT("en"));

FTTLConfig TTLConfig{};
TTLConfig.Action = EAccelByteTTLConfigAction::DELETE_RECORD;
TTLConfig.Expires_At = FDateTime::UtcNow() + FTimespan(0, 0, 5); // Will delete this record in the next five seconds

ServerApiClient->ServerCloudSave.SaveGameRecord(Key
, DataJson
, FVoidHandler::CreateLambda([]()
{
// Do something if SaveGameRecord is successful
})
, FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if SaveGameRecord has an error
})
, TTLConfig);

Create admin player records

Unreal Engine

FServerApiClientPtr ServerApiClient = FMultiRegistry::GetServerApiClient();

FString UserId = "SomeUserId";
FString Key = "SomeCloudSaveKey";

FJsonObject DataJson;
const FString gameId = FGuid::NewGuid().ToString();
DataJson.SetStringField("gameId", gameId);
DataJson.SetStringField("region", TEXT("ID"));
DataJson.SetStringField("language", TEXT("en"));

ServerApiClient->ServerCloudSave.SaveUserRecord(UserId
, Key
, DataJson
, FVoidHandler::CreateLambda([]()
{
// Do something if SaveUserRecord is successful
})
, FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if SaveUserRecord has an error
}));

Retrieve admin records from Game Server

You can retrieve admin records from the Game server through the following methods:

Retrieve a specific admin game record by key

Unreal Engine

FServerApiClientPtr ServerApiClient = FMultiRegistry::GetServerApiClient();

FString Key = "SomeCloudSaveKey";

ServerApiClient->ServerCloudSave.GetGameRecord(Key
, THandler<FAccelByteModelsGameRecord>::CreateLambda([](const FAccelByteModelsGameRecord& Response)
{
// Do something if GetGameRecord is successful
})
, FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if GetGameRecord has an error
}));

Retrieve a specific admin player record for a specific user ID key

Unreal Engine

FServerApiClientPtr ServerApiClient = FMultiRegistry::GetServerApiClient();

FString Key = "SomeCloudSaveKey";
FString UserId = "SomeUserId";

ServerApiClient->ServerCloudSave.GetUserRecord(Key
, UserId
, THandler<FAccelByteModelsUserRecord>::CreateLambda([](const FAccelByteModelsUserRecord& Response)
{
// Do something if GetUserRecord is successful
})
, FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if GetUserRecord has an error
}));

Modify admin records from the Game Server

To modify or update data within admin records from the Game Server, follow these steps:

Modify admin game records

Unreal Engine

FServerApiClientPtr ServerApiClient = FMultiRegistry::GetServerApiClient();

FString Key = "SomeCloudSaveKey";

FJsonObject DataJson;
const FString gameId = FGuid::NewGuid().ToString();
DataJson.SetStringField("gameId", gameId);
DataJson.SetStringField("region", TEXT("ES"));
DataJson.SetStringField("language", TEXT("es"));

ServerApiClient->ServerCloudSave.ReplaceGameRecord(Key
, DataJson
, FVoidHandler::CreateLambda([]()
{
// Do something if ReplaceGameRecord is successful
})
, FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if ReplaceGameRecord has an error
}));

Modify admin game records to become temporary

Unreal Engine

FServerApiClientPtr ServerApiClient = FMultiRegistry::GetServerApiClient();

FString Key = "SomeCloudSaveKey";

FJsonObject DataJson;
const FString gameId = FGuid::NewGuid().ToString();
DataJson.SetStringField("gameId", gameId);
DataJson.SetStringField("region", TEXT("ES"));
DataJson.SetStringField("language", TEXT("es"));

FTTLConfig TTLConfig{};
TTLConfig.Action = EAccelByteTTLConfigAction::DELETE_RECORD;
TTLConfig.Expires_At = FDateTime::UtcNow() + FTimespan(0, 0, 5); // Will delete this record in the next five seconds

ServerApiClient->ServerCloudSave.ReplaceGameRecord(Key
, DataJson
, FVoidHandler::CreateLambda([]()
{
// Do something if ReplaceGameRecord is successful
})
, FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if ReplaceGameRecord has an error
})
, TTLConfig);

Modify admin player records

Unreal Engine

FServerApiClientPtr ServerApiClient = FMultiRegistry::GetServerApiClient();

FString Key = "SomeCloudSaveKey";
FString UserId = "SomeUserId";

FJsonObject DataJson;
const FString gameId = FGuid::NewGuid().ToString();
DataJson.SetStringField("gameId", gameId);
DataJson.SetStringField("region", TEXT("ES"));
DataJson.SetStringField("language", TEXT("es"));

ServerApiClient->ServerCloudSave.ReplaceUserRecord(Key
, UserId
, DataJson
, FVoidHandler::CreateLambda([]()
{
// Do something if ReplaceUserRecord is successful
})
, FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if ReplaceUserRecord has an error
}));

Delete admin records from game server

To delete admin records from the Game Server, follow these steps:

Delete Admin Game Records

Unreal Engine

FServerApiClientPtr ServerApiClient = FMultiRegistry::GetServerApiClient();

FString Key = "SomeCloudSaveKey";

ServerApiClient->ServerCloudSave.DeleteGameRecord(Key
, FVoidHandler::CreateLambda([]()
{
// Do something if DeleteGameRecord is successful
})
, FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if DeleteGameRecord has an error
}));

Delete admin player records

Unreal Engine

FServerApiClientPtr ServerApiClient = FMultiRegistry::GetServerApiClient();

FString Key = "SomeCloudSaveKey";
FString UserId = "SomeUserId";
bool bIsPublic = true;

ServerApiClient->ServerCloudSave.DeleteUserRecord(Key
, UserId
, bIsPublic
, FVoidHandler::CreateLambda([]()
{
// Do something if DeleteUserRecord is successful
})
, FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if DeleteUserRecord has an error
}));