Skip to main content

Store restricted player and game data in admin records

Last updated on December 9, 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"));

TArray<FString> Tags = {TEXT("Tags1"), TEXT("Tags2"};

ServerApiClient->ServerCloudSave.CreateAdminGameRecord(Key
, DataJson
, THandler<FAccelByteModelsAdminGameRecord>::CreateLambda([](const FAccelByteModelsAdminGameRecord& Response)
{
// Do something if CreateAdminGameRecord succeeds
})
, FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if CreateAdminGameRecord fails
})
, Tags);

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"));

TArray<FString> Tags = {TEXT("Tags1"), TEXT("Tags2"};

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.CreateAdminGameRecord(Key
, DataJson
, THandler<FAccelByteModelsAdminGameRecord>::CreateLambda([](const FAccelByteModelsAdminGameRecord& Response)
{
// Do something if CreateAdminGameRecord succeeds
})
, FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if CreateAdminGameRecord fails
})
, Tags
, 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.CreateAdminUserRecord(Key
, UserId
, DataJson
, THandler<FAccelByteModelsAdminUserRecord>::CreateLambda([](const FAccelByteModelsAdminUserRecord& Response)
{
// Do something if CreateAdminUserRecord succeeds
})
, FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if CreateAdminUserRecord fails
}));

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.QueryAdminGameRecordsByKey(Key
, THandler<FAccelByteModelsAdminGameRecord>::CreateLambda([](const FAccelByteModelsAdminGameRecord& Response)
{
// Do something if QueryAdminGameRecordsByKey succeeds
})
, FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if QueryAdminGameRecordsByKey fails
}));

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.QueryAdminUserRecordsByKey(Key
, UserId
, THandler<FAccelByteModelsAdminUserRecord>::CreateLambda([](const FAccelByteModelsAdminUserRecord& Response)
{
// Do something if QueryAdminUserRecordsByKey succeeds
})
, FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if QueryAdminUserRecordsByKey fails
}));

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.ReplaceAdminGameRecord(Key
, DataJson
, THandler<FAccelByteModelsAdminGameRecord>::CreateLambda([](const FAccelByteModelsAdminGameRecord& Response)
{
// Do something if ReplaceAdminGameRecord succeeds
})
, FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if ReplaceAdminGameRecord fails
}));

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.ReplaceAdminGameRecord(Key
, DataJson
, THandler<FAccelByteModelsAdminGameRecord>::CreateLambda([](const FAccelByteModelsAdminGameRecord& Response)
{
// Do something if ReplaceAdminGameRecord succeeds
})
, FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if ReplaceAdminGameRecord fails
})
, 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.ReplaceAdminUserRecord(Key
, UserId
, DataJson
, THandler<FAccelByteModelsAdminUserRecord>::CreateLambda([](const FAccelByteModelsAdminUserRecord& Response)
{
// Do something if ReplaceAdminUserRecord succeeds
})
, FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if ReplaceAdminUserRecord fails
}));

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.DeleteAdminGameRecord(Key
, FVoidHandler::CreateLambda([]()
{
// Do something if DeleteAdminGameRecord succeeds
})
, FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if DeleteAdminGameRecord fails
}));

Delete admin player records

Unreal Engine
FServerApiClientPtr ServerApiClient = FMultiRegistry::GetServerApiClient();

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

ServerApiClient->ServerCloudSave.DeleteAdminUserRecord(Key
, UserId
, FVoidHandler::CreateLambda([]()
{
// Do something if DeleteAdminUserRecord succeeds
})
, FErrorHandler::CreateLambda([](int32 ErrorCode, const FString& ErrorMessage)
{
// Do something if DeleteAdminUserRecord fails
}));