Skip to main content

Store restricted player and game data in admin records

Last updated on April 4, 2024

Goals

In this guide, you will learn:

  • How to access admin records in the AccelByte Gaming Services (AGS) Admin Portal.
  • How to 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. In your namespace on the AGS Admin Portal, go to the Game Management section.

  2. Open the Cloud Save menu and select Admin Records.

    Admin Records Management

  3. On the Admin Record page, you will see two tabs: Game Records and Player Records. Open a tab to view a list of records it contains.

Create a new admin record

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

  1. On the Admin Record page, select the Game Records or the Player Records tab, based on the type of record you want to create. Then, click the Create 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/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/game server can access it.
  2. Fill in the required fields on the form.

    • Game Records

      • In the User ID box, add the user ID of the user that will be associated with the record.

      • In the Key box, add the Game Record key. This is the identifier of the record.

      • In the JSON Configuration box, add the data you want to store in JSON format.

        Image shows the Add Record form

    • Player Records

      • In the User ID box, add the user ID of the user that will be associated with the record.

      • In the Key box, add the Player Record key. This is the identifier of the record.

      • In the JSON Configuration box, add the data you want to store in JSON format.

        Image shows the Player Records form

  3. After filling in the information, click Add to create the new 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. In the Game Management sercton, go to the Cloud Save menu and select Admin Records.

  2. On the Admin Record page, go to the records tab that contains the record you want to modify.

    a. For game records you can simply choose the record you want to modify by clicking View in the Action menu.

    Image shows the View button of a record

    b. For player records you need to search the records by User ID first and choose the record you want to modify by clicking View in the Action menu.

    Image shows the search box for player records

  3. In the Record Detail page, go to the JSON Configuration section and click Edit.

    Image shows the Edit button on the Record Detail page

  4. Update the record as needed.

  5. Click Save to finish.

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. In the Game Management section, go to the Cloud Save menu and select Admin Records.

  2. On the Admin Record page, you will find 2 tabs Game and Player Records. Navigate to the desired tab, a. For game records you can simply choose the record you want to delete by clicking Delete in the Action menu.

    Image shows the Delete button for records

    b. For player records you need to search the records by User ID first and choose the record you want to delete by clicking Delete in the Action menu.

    Image shows the Edit button on the Record Detail page

  3. The Delete Record confirmation pop-up will appear. Click Delete to finish.

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