Store restricted player and game data in admin records
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:
- The AGS Admin Portal
- The AGS Cloud Save API documentation
Manage admin records in the Admin Portal
Access the Admin Records page
On the Admin Portal sidebar, go to Progression & Inventory > Cloud Save > Admin Records.
On the Admin Records page, depending on the record type you want to view, open the Game Records or the Player Records tab.
Create a new admin record
To create a new admin record to store player or game data, follow these steps:
On the Admin Portal sidebar, go to Progression & Inventory > Cloud Save > Admin Records.
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.
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.
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.
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:
On the Admin Portal sidebar, go to Progression & Inventory > Cloud Save > Admin Records.
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.
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.
On the details page of the record, click on the pencil or edit icon of the fields or sections to update the content.
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:
On the Admin Portal sidebar, go to Progression & Inventory > Cloud Save > Admin Records.
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.
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.
Click Delete on the confirmation message. The record is immediately deleted from the records list.
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
- Unity
- Go Extend SDK
- Python Extend SDK
- Java Extend SDK
- C# Extend SDK
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);
ServerCloudSave serverCloudSave = AccelByteSDK.GetServerRegistry().GetApi().GetCloudSave();
string key = "SomeCloudSaveKey";
string gameId = Guid.NewGuid().ToString();
Dictionary<string, object> dataJson = new Dictionary<string, object>
{
{"gameId", gameId }, {"region", "ID" }, {"language", "en" }
};
var optionalParams = new AdminRecordMetadataOptionalParams()
{
SetBy = RecordSetBy.SERVER
};
serverCloudSave.CreateAdminGameRecord(key, dataJson, optionalParams, result =>
{
if (result.IsError)
{
// Do something if CreateAdminGameRecord fails
Debug.Log($"Error CreateAdminGameRecord, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
return;
}
// Do something if CreateAdminGameRecord succeeds
});
adminGameRecordService := &cloudsave.AdminGameRecordService{
Client: factory.NewCloudsaveClient(&repository.ConfigRepositoryImpl{}),
TokenRepository: &repository.TokenRepositoryImpl{},
}
key := "someKey"
body := map[string]interface{}{
"gameId": "5a7aab0c7e2147c4be9693083748634f",
"region": "US",
"language": "en",
}
namespace := "mygame"
input := &admin_game_record.AdminPostGameRecordHandlerV1Params{
Body: body,
Key: key,
Namespace: namespace,
}
result, err := adminGameRecordService.AdminPostGameRecordHandlerV1Short(input)
import accelbyte_py_sdk.api.cloudsave as cloudsave_service
import accelbyte_py_sdk.api.cloudsave.models as cloudsave_models
result, error = cloudsave_service.admin_post_game_record_handler_v1(
body=cloudsave_models.ModelsGameRecordRequest.create(
{
"gameId": "****",
"region": "ID",
"language": "en",
"__META": {
"set_by": "SERVER"
}
}
),
key="SomeCloudSaveKey",
)
if error:
exit(error)
@Builder
public class MyGameRecord extends ModelsGameRecordRequest {
@JsonProperty("gameId")
public String gameId;
@JsonProperty("region")
public String region;
@JsonProperty("language")
public String language;
}
...
final AdminGameRecord adminGameRecordWrapper = new AdminGameRecord(sdk);
String key = "graphicQuality";
String userId = "<user-id>";
var record = MyGameRecord.builder()
.gameId(UUID.randomUUID().toString().replace("-", ""))
.language("en")
.region("US")
.build();
ModelsGameRecordAdminResponse response;
try {
response = adminGameRecordWrapper.adminPostGameRecordHandlerV1(AdminPostGameRecordHandlerV1.builder()
.namespace("<namespace>")
.key(key)
.body(record)
.build());
} catch (Exception e) {
// Do something when failed
return;
}
if (response == null) {
// Null response from server
} else {
// Do something with response when successful
}
public class MyGameRecord : ModelsGameRecordRequest
{
[JsonPropertyName("gameId")]
public string GameId { get; set; } = "";
[JsonPropertyName("region")]
public string Region { get; set; } = "";
[JsonPropertyName("language")]
public string Language { get; set; } = "";
}
string key = "someKey";
var record = new MyGameRecord()
{
GameId = Guid.NewGuid().ToString().Replace("-", ""),
Language = "en",
Region = "US"
};
var response = sdk.Cloudsave.AdminGameRecord.AdminPostGameRecordHandlerV1Op
.Execute(record, key, sdk.Namespace);
if (response != null)
{
// Do something with response when successful
}
Create a temporary admin game records
- Unreal Engine
- Unity
- Go Extend SDK
- Python Extend SDK
- Java Extend SDK
- C# Extend SDK
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);
ServerCloudSave serverCloudSave = AccelByteSDK.GetServerRegistry().GetApi().GetCloudSave();
string key = "SomeCloudSaveKey";
string gameId = Guid.NewGuid().ToString();
Dictionary<string, object> dataJson = new Dictionary<string, object>
{
{"gameId", gameId }, {"region", "ID" }, {"language", "en" }
};
var ttlConfig = new TTLConfig()
{
Action = TTLConfigAction.Delete,
ExpiresAt = DateTime.Now.AddSeconds(5) // Will delete this record in the next five sceonds
};
var optionalParams = new AdminRecordMetadataOptionalParams()
{
SetBy = RecordSetBy.CLIENT,
TTLConfig = ttlConfig
};
serverCloudSave.CreateAdminGameRecord(key, dataJson, optionalParams, result =>
{
if (result.IsError)
{
// Do something if CreateAdminGameRecord fails
Debug.Log($"Error CreateAdminGameRecord, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
return;
}
// Do something if CreateAdminGameRecord succeeds
});
adminGameRecordService := &cloudsave.AdminGameRecordService{
Client: factory.NewCloudsaveClient(&repository.ConfigRepositoryImpl{}),
TokenRepository: &repository.TokenRepositoryImpl{},
}
key := "someKey"
body := map[string]interface{}{
"gameId": "5a7aab0c7e2147c4be9693083748634f",
"region": "US",
"language": "en",
"__META": map[string]interface{}{
"ttl_config": map[string]interface{}{
"action":"DELETE",
"expires_at":"2025-12-31T08:00:00",
},
},
}
namespace := "mygame"
input := &admin_game_record.AdminPostGameRecordHandlerV1Params{
Body: body,
Key: key,
Namespace: namespace,
}
result, err := adminGameRecordService.AdminPostGameRecordHandlerV1Short(input)
from datetime import datetime, timedelta
import accelbyte_py_sdk.api.cloudsave as cloudsave_service
import accelbyte_py_sdk.api.cloudsave.models as cloudsave_models
result, error = cloudsave_service.admin_post_game_record_handler_v1(
body=cloudsave_models.ModelsGameRecordRequest.create(
{
"gameId": "****",
"region": "ID",
"language": "en",
"__META": {
"set_by": "SERVER",
"ttl_config": {
"action": "DELETE",
"expires_at": (datetime.now() + timedelta(seconds=5)).isoformat(),
}
}
}
),
key="SomeCloudSaveKey",
)
if error:
exit(error)
@Builder
public class MyGameRecordWithMeta extends ModelsGameRecordRequest {
@Builder
public class TTLConfig {
@JsonProperty("action")
public String action;
@JsonProperty("expires_at")
public String expiresAt;
}
@Builder
public class Meta
{
@JsonProperty("set_by")
public String setBy;
@JsonProperty("is_public")
public boolean isPublic;
@JsonProperty("ttl_config")
public TTLConfig ttlConfig;
}
@JsonProperty("__META")
public Meta RecordMeta;
@JsonProperty("lastLocation")
public String lastLocation;
@JsonProperty("gameId")
public String gameId;
@JsonProperty("region")
public String region;
@JsonProperty("language")
public String language;
}
...
final AdminGameRecord adminGameRecordWrapper = new AdminGameRecord(sdk);
String key = "someKey";
var record = MyGameRecordWithMeta.builder()
.RecordMeta(MyGameRecordWithMeta.Meta.builder()
.setBy("SERVER")
.ttlConfig(MyGameRecordWithMeta.Meta.builder().ttlConfig.builder()
.action("DELETE")
.expiresAt(Instant.now().plusSeconds(5*60).atOffset(ZoneOffset.UTC).format(DateTimeFormatter.ISO_OFFSET_DATE_TIME)) //expires in 5 minutes
.build())
.build())
.gameId(UUID.randomUUID().toString().replace("-",""))
.language("en")
.region("US")
.build();
ModelsGameRecordAdminResponse response;
try {
response = adminGameRecordWrapper.adminPostGameRecordHandlerV1(AdminPostGameRecordHandlerV1.builder()
.namespace("<namespace>")
.key(key)
.body(record)
.build());
} catch (Exception e) {
// Do something when failed
return;
}
if (response == null) {
// Null response from server
} else {
// Do something with response when successful
}
public class MyGameRecordWithMeta : ModelsGameRecordRequest
{
public class TTLConfig
{
[JsonPropertyName("action")]
public string Action { get; set; } = "";
[JsonPropertyName("expires_at")]
public string ExpiresAt { get; set; } = "";//ISO8601 date format
}
public class Meta
{
[JsonPropertyName("set_by")]
public string SetBy { get; set; } = "";
[JsonPropertyName("is_public")]
public bool IsPublic { get; set; } = false;
[JsonPropertyName("ttl_config")]
public TTLConfig TTL { get; set; } = new TTLConfig();
}
[JsonPropertyName("__META")]
public Meta RecordMeta { get; set; } = new Meta();
[JsonPropertyName("gameId")]
public string GameId { get; set; } = "";
[JsonPropertyName("region")]
public string Region { get; set; } = "";
[JsonPropertyName("language")]
public string Language { get; set; } = "";
}
string key = "someKey";
var record = new MyGameRecordWithMeta()
{
RecordMeta = new MyGameRecordWithMeta.Meta()
{
SetBy = "SERVER",
TTL = new MyGameRecordWithMeta.TTLConfig()
{
Action = "DELETE",
ExpiresAt = DateTime.Now.AddMinutes(5).ToString("O",CultureInfo.InvariantCulture) //expires in 5 minutes
}
},
GameId = Guid.NewGuid().ToString().Replace("-", ""),
Language = "en",
Region = "US"
};
var response = sdk.Cloudsave.AdminGameRecord.AdminPostGameRecordHandlerV1Op
.Execute(record, key, sdk.Namespace);
if (response != null)
{
// Do something with response when successful
}
Create admin player records
- Unreal Engine
- Unity
- Go Extend SDK
- Python Extend SDK
- Java Extend SDK
- C# Extend SDK
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
}));
ServerCloudSave serverCloudSave = AccelByteSDK.GetServerRegistry().GetApi().GetCloudSave();
string userId = "SomeUserId";
string key = "SomeCloudSaveKey";
string gameId = Guid.NewGuid().ToString();
Dictionary<string, object> dataJson = new Dictionary<string, object>
{
{"gameId", gameId }, {"region", "ID" }, {"language", "en" }
};
serverCloudSave.CreateAdminUserRecord(key, userId, dataJson, result =>
{
if (result.IsError)
{
// Do something if CreateAdminUserRecord fails
Debug.Log($"Error CreateAdminUserRecord, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
return;
}
// Do something if CreateAdminUserRecord succeeds
});
adminPlayerRecordService := &cloudsave.AdminPlayerRecordService{
Client: factory.NewCloudsaveClient(&repository.ConfigRepositoryImpl{}),
TokenRepository: &repository.TokenRepositoryImpl{},
}
key := "someKey"
body := map[string]interface{}{
"__META": map[string]interface{}{
"set_by":"SERVER",
},
"lastLocation":"x:2330,y:8710",
}
namespace := "mygame"
userId := "myuserid"
input := &admin_player_record.AdminPostPlayerRecordHandlerV1Params{
Body: body,
Key: key,
Namespace: namespace,
UserID: userId,
}
result, err := adminPlayerRecordService.AdminPostPlayerRecordHandlerV1Short(input)
import accelbyte_py_sdk.api.cloudsave as cloudsave_service
import accelbyte_py_sdk.api.cloudsave.models as cloudsave_models
result, error = cloudsave_service.admin_post_player_record_handler_v1(
body=cloudsave_models.ModelsPlayerRecordRequest.create(
{
"gameId": "****",
"region": "ID",
"language": "en",
"__META": {
"set_by": "SERVER"
}
}
),
key="SomeCloudSaveKey",
user_id="********************************",
)
if error:
exit(error)
final AdminPlayerRecord adminPlayerRecordWrapper = new AdminPlayerRecord(sdk);
String key = "characterLocation";
String userId = "<user-id>";
var record = MyCharacterLocation.builder()
.RecordMeta(MyCharacterLocation.Meta.builder()
.setBy("SERVER")
.build())
.lastLocation("x:2330,y:8710")
.build();
ModelsPlayerRecordResponse response;
try {
response = adminPlayerRecordWrapper.adminPostPlayerRecordHandlerV1(AdminPostPlayerRecordHandlerV1.builder()
.namespace("<namespace>")
.userId(userId)
.key(key)
.body(record)
.build());
} catch (Exception e) {
// Do something when failed
return;
}
if (response == null) {
// Null response from server
} else {
// Do something with response when successful
}
string key = "someKey";
string userId = "<user-id>";
var record = new MyCharacterLocation()
{
RecordMeta = new MyCharacterLocation.Meta()
{
SetBy = "SERVER"
},
LastLocation = "x:2330,y:8710"
};
var response = sdk.Cloudsave.AdminPlayerRecord.AdminPostPlayerRecordHandlerV1Op
.Execute(record, key, sdk.Namespace, userId);
if (response != null)
{
// Do something with response when successful
}
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.
- Retrieve a specific admin player record for a specific user ID by key.
Retrieve a specific admin game record by key
- Unreal Engine
- Unity
- Go Extend SDK
- Python Extend SDK
- Java Extend SDK
- C# Extend SDK
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
}));
ServerCloudSave serverCloudSave = AccelByteSDK.GetServerRegistry().GetApi().GetCloudSave();
string key = "SomeCloudSaveKey";
serverCloudSave.QueryAdminGameRecordsByKey(key, result =>
{
if (result.IsError)
{
// Do something if QueryAdminGameRecordsByKey fails
Debug.Log($"Error QueryAdminGameRecordsByKey, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
}
// Do something if QueryAdminGameRecordsByKey succeeds
});
adminGameRecordService := &cloudsave.AdminGameRecordService{
Client: factory.NewCloudsaveClient(&repository.ConfigRepositoryImpl{}),
TokenRepository: &repository.TokenRepositoryImpl{},
}
key := "someKey"
namespace := "mygame"
input := &admin_game_record.AdminGetGameRecordHandlerV1Params{
Key: key,
Namespace: namespace,
}
result, err := adminGameRecordService.AdminGetGameRecordHandlerV1Short(input)
import accelbyte_py_sdk.api.cloudsave as cloudsave_service
import accelbyte_py_sdk.api.cloudsave.models as cloudsave_models
result, error = cloudsave_service.admin_get_game_record_handler_v1(
key="SomeCloudSaveKey",
)
if error:
exit(error)
final AdminGameRecord adminGameRecordWrapper = new AdminGameRecord(sdk);
String key = "someKey";
ModelsGameRecordAdminResponse response;
try {
response = adminGameRecordWrapper.adminGetGameRecordHandlerV1(AdminGetGameRecordHandlerV1.builder()
.namespace("<namespace>")
.key(key)
.build());
} catch (Exception e) {
// Do something when failed
return;
}
if (response == null) {
// Null response from server
} else {
// Do something with the data
}
string key = "someKey";
var response = sdk.Cloudsave.AdminGameRecord.AdminGetGameRecordHandlerV1Op
.Execute(key, sdk.Namespace);
if (response != null)
{
// Do something with the data
}
Retrieve a specific admin player record for a specific user ID key
- Unreal Engine
- Unity
- Go Extend SDK
- Python Extend SDK
- Java Extend SDK
- C# Extend SDK
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
}));
ServerCloudSave serverCloudSave = AccelByteSDK.GetServerRegistry().GetApi().GetCloudSave();
string userId = "SomeUserId";
string key = "SomeCloudSaveKey";
serverCloudSave.QueryAdminUserRecordsByKey(key, userId, result =>
{
if (result.IsError)
{
// Do something if QueryAdminUserRecordsByKey fails
Debug.Log($"Error QueryAdminUserRecordsByKey, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
return;
}
// Do something if QueryAdminUserRecordsByKey succeeds
});
adminPlayerRecordService := &cloudsave.AdminPlayerRecordService{
Client: factory.NewCloudsaveClient(&repository.ConfigRepositoryImpl{}),
TokenRepository: &repository.TokenRepositoryImpl{},
}
key := "someKey"
namespace := "mygame"
userId := "myuserid"
input := &admin_player_record.AdminGetPlayerRecordHandlerV1Params{
Key: key,
Namespace: namespace,
UserID: userId,
}
result, err := adminPlayerRecordService.AdminGetPlayerRecordHandlerV1Short(input)
import accelbyte_py_sdk.api.cloudsave as cloudsave_service
import accelbyte_py_sdk.api.cloudsave.models as cloudsave_models
result, error = cloudsave_service.admin_get_player_record_handler_v1(
key="SomeCloudSaveKey",
user_id="********************************",
)
if error:
exit(error)
final AdminPlayerRecord adminPlayerRecordWrapper = new AdminPlayerRecord(sdk);
String key = "someKey";
String userId = "<user-id>";
ModelsPlayerRecordResponse response;
try {
response = adminPlayerRecordWrapper.adminGetPlayerRecordHandlerV1(AdminGetPlayerRecordHandlerV1.builder()
.namespace("<namespace>")
.userId(userId)
.key(key)
.build());
} catch (Exception e) {
// Do something when failed
return;
}
if (response == null) {
// Null response from server
} else {
// Do something with the data
}
string key = "someKey";
string userId = "<user-id>";
var response = sdk.Cloudsave.AdminPlayerRecord.AdminGetPlayerRecordHandlerV1Op
.Execute(key, sdk.Namespace, userId);
if (response != null)
{
// Do something with the data
}
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
- Unity
- Go Extend SDK
- Python Extend SDK
- Java Extend SDK
- C# Extend SDK
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
}));
ServerCloudSave serverCloudSave = AccelByteSDK.GetServerRegistry().GetApi().GetCloudSave();
string key = "SomeCloudSaveKey";
string gameId = Guid.NewGuid().ToString();
Dictionary<string, object> dataJson = new Dictionary<string, object>
{
{"gameId", gameId }, {"region", "ES" }, {"language", "es" }
};
var optionalParams = new GameRecordMetadataOptionalParams()
{
SetBy = RecordSetBy.SERVER,
};
serverCloudSave.ReplaceAdminGameRecord(key, dataJson, optionalParams, result =>
{
if (result.IsError)
{
// Do something if ReplaceAdminGameRecord fails
Debug.Log($"Error ReplaceAdminGameRecord, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
return;
}
// Do something if ReplaceAdminGameRecord succeeds
});
adminGameRecordService := &cloudsave.AdminGameRecordService{
Client: factory.NewCloudsaveClient(&repository.ConfigRepositoryImpl{}),
TokenRepository: &repository.TokenRepositoryImpl{},
}
key, _ := cmd.Flags().GetString("key")
body := map[string]interface{}{
"gameId": "5a7aab0c7e2147c4be9693083748634f",
"region": "US",
"language": "en",
}
namespace := "mygame"
input := &admin_game_record.AdminPutGameRecordHandlerV1Params{
Body: body,
Key: key,
Namespace: namespace,
}
result, err := adminGameRecordService.AdminPutGameRecordHandlerV1Short(input)
import accelbyte_py_sdk.api.cloudsave as cloudsave_service
import accelbyte_py_sdk.api.cloudsave.models as cloudsave_models
result, error = cloudsave_service.admin_put_game_record_handler_v1(
body=cloudsave_models.ModelsGameRecordRequest.create(
{
"gameId": "****",
"region": "ES",
"language": "es",
"__META": {
"set_by": "SERVER"
}
}
),
key="SomeCloudSaveKey",
)
if error:
exit(error)
final AdminGameRecord adminGameRecordWrapper = new AdminGameRecord(sdk);
String key = "someKey";
var record = MyGameRecord.builder()
.gameId(UUID.randomUUID().toString().replace("-", ""))
.language("en")
.region("US")
.build();
ModelsGameRecordAdminResponse response;
try {
response = adminGameRecordWrapper.adminPutGameRecordHandlerV1(AdminPutGameRecordHandlerV1.builder()
.namespace("<namespace>")
.key(key)
.body(record)
.build());
} catch (Exception e) {
// Do something when failed
return;
}
if (response == null) {
// Null response from server
} else {
// Do something with response when successful
}
string key = "someKey";
var record = new MyGameRecord()
{
GameId = Guid.NewGuid().ToString().Replace("-", ""),
Language = "en",
Region = "US"
};
var response = sdk.Cloudsave.AdminGameRecord.AdminPutGameRecordHandlerV1Op
.Execute(record, key, sdk.Namespace);
if (response != null)
{
// Do something with response when successful
}
Modify admin game records to become temporary
- Unreal Engine
- Unity
- Go Extend SDK
- Python Extend SDK
- Java Extend SDK
- C# Extend SDK
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);
ServerCloudSave serverCloudSave = AccelByteSDK.GetServerRegistry().GetApi().GetCloudSave();
string key = "SomeCloudSaveKey";
string gameId = Guid.NewGuid().ToString();
Dictionary<string, object> dataJson = new Dictionary<string, object>
{
{"gameId", gameId }, {"region", "ES" }, {"language", "es" }
};
var ttlConfig = new TTLConfig()
{
Action = TTLConfigAction.Delete,
ExpiresAt = DateTime.Now.AddSeconds(5) // Will delete this record in the next five sceonds
};
var optionalParams = new GameRecordMetadataOptionalParams()
{
TTLConfig = ttlConfig
SetBy = RecordSetBy.SERVER,
};
serverCloudSave.ReplaceAdminGameRecord(key, dataJson, optionalParams, result =>
{
if (result.IsError)
{
// Do something if ReplaceAdminGameRecord fails
Debug.Log($"Error ReplaceAdminGameRecord, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
return;
}
// Do something if ReplaceAdminGameRecord succeeds
});
adminGameRecordService := &cloudsave.AdminGameRecordService{
Client: factory.NewCloudsaveClient(&repository.ConfigRepositoryImpl{}),
TokenRepository: &repository.TokenRepositoryImpl{},
}
key, _ := cmd.Flags().GetString("key")
body := map[string]interface{}{
"gameId": "5a7aab0c7e2147c4be9693083748634f",
"region": "US",
"language": "en",
"__META": map[string]interface{}{
"ttl_config": map[string]interface{}{
"action":"DELETE",
"expires_at":"2025-12-31T08:00:00",
},
},
}
namespace := "mygame"
input := &admin_game_record.AdminPutGameRecordHandlerV1Params{
Body: body,
Key: key,
Namespace: namespace,
}
result, err := adminGameRecordService.AdminPutGameRecordHandlerV1Short(input)
import accelbyte_py_sdk.api.cloudsave as cloudsave_service
import accelbyte_py_sdk.api.cloudsave.models as cloudsave_models
result, error = cloudsave_service.admin_put_game_record_handler_v1(
body=cloudsave_models.ModelsGameRecordRequest.create(
{
"gameId": "****",
"region": "ES",
"language": "es",
"__META": {
"set_by": "SERVER"
}
}
),
key="SomeCloudSaveKey",
)
if error:
exit(error)
final AdminGameRecord adminGameRecordWrapper = new AdminGameRecord(sdk);
String key = "someKey";
var record = MyGameRecordWithMeta.builder()
.RecordMeta(MyGameRecordWithMeta.Meta.builder()
.setBy("SERVER")
.ttlConfig(MyGameRecordWithMeta.Meta.builder().ttlConfig.builder()
.action("DELETE")
.expiresAt(Instant.now().plusSeconds(5*60).atOffset(ZoneOffset.UTC).format(DateTimeFormatter.ISO_OFFSET_DATE_TIME)) //expires in 5 minutes
.build())
.build())
.gameId(UUID.randomUUID().toString().replace("-",""))
.language("en")
.region("US")
.build();
ModelsGameRecordAdminResponse response;
try {
response = adminGameRecordWrapper.adminPutGameRecordHandlerV1(AdminPutGameRecordHandlerV1.builder()
.namespace("<namespace>")
.key(key)
.body(record)
.build());
} catch (Exception e) {
// Do something when failed
return;
}
if (response == null) {
// Null response from server
} else {
// Do something with response when successful
}
string key = "someKey";
var record = new MyGameRecordWithMeta()
{
RecordMeta = new MyGameRecordWithMeta.Meta()
{
SetBy = "SERVER",
TTL = new MyGameRecordWithMeta.TTLConfig()
{
Action = "DELETE",
ExpiresAt = DateTime.Now.AddMinutes(5).ToString("O", CultureInfo.InvariantCulture) //expires in 5 minutes
}
},
GameId = Guid.NewGuid().ToString().Replace("-", ""),
Language = "en",
Region = "US"
};
var response = sdk.Cloudsave.AdminGameRecord.AdminPutGameRecordHandlerV1Op
.Execute(record, key, sdk.Namespace);
if (response != null)
{
// Do something with response when successful
}
Modify admin player records
- Unreal Engine
- Unity
- Go Extend SDK
- Python Extend SDK
- Java Extend SDK
- C# Extend SDK
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
}));
ServerCloudSave serverCloudSave = AccelByteSDK.GetServerRegistry().GetApi().GetCloudSave();
string userId = "SomeUserId";
string key = "SomeCloudSaveKey";
string gameId = Guid.NewGuid().ToString();
Dictionary<string, object> dataJson = new Dictionary<string, object>
{
{"gameId", gameId }, {"region", "ES" }, {"language", "es" }
};
serverCloudSave.ReplaceAdminUserRecord(key, userId, dataJson, result =>
{
if (result.IsError)
{
// Do something if ReplaceAdminUserRecord fails
Debug.Log($"Error ReplaceAdminUserRecord, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
return;
}
// Do something if ReplaceAdminUserRecord succeeds
});
adminPlayerRecordService := &cloudsave.AdminPlayerRecordService{
Client: factory.NewCloudsaveClient(&repository.ConfigRepositoryImpl{}),
TokenRepository: &repository.TokenRepositoryImpl{},
}
key := "someKey"
body := map[string]interface{}{
"textures": 2,
"shadow": 2,
"lighting": 2,
"post-precessing": 2,
}
namespace := "mygame"
userId := "myuserid"
input := &admin_player_record.AdminPutPlayerRecordHandlerV1Params{
Body: body,
Key: key,
Namespace: namespace,
UserID: userId,
}
result, err := adminPlayerRecordService.AdminPutPlayerRecordHandlerV1Short(input)
import accelbyte_py_sdk.api.cloudsave as cloudsave_service
import accelbyte_py_sdk.api.cloudsave.models as cloudsave_models
result, error = cloudsave_service.admin_put_player_record_handler_v1(
body=cloudsave_models.ModelsPlayerRecordRequest.create(
{
"gameId": "****",
"region": "ES",
"language": "es",
"__META": {
"set_by": "SERVER",
}
}
),
key="SomeCloudSaveKey",
user_id="********************************",
)
if error:
exit(error)
final AdminPlayerRecord adminPlayerRecordWrapper = new AdminPlayerRecord(sdk);
String key = "graphicQuality";
String userId = "<user-id>";
var record = MyGraphicQuality.builder()
.textures(2)
.shadow(2)
.lighting(2)
.postProcessing(2)
.build();
ModelsPlayerRecordResponse response;
try {
response = adminPlayerRecordWrapper.adminPutPlayerRecordHandlerV1(AdminPutPlayerRecordHandlerV1.builder()
.namespace("<namespace>")
.userId(userId)
.key(key)
.body(record)
.build());
} catch (Exception e) {
// Do something when failed
return;
}
if (response == null) {
// Null response from server
} else {
// Do something with response when successful
}
string key = "someKey";
string userId = "<user-id>";
var record = new MyGraphicQuality()
{
Textures = 2,
Shadow = 2,
Lighting = 2,
PostProcessing = 2
};
var response = sdk.Cloudsave.AdminPlayerRecord.AdminPutPlayerRecordHandlerV1Op
.Execute(record, key, sdk.Namespace, userId);
if (response != null)
{
// Do something with response when successful
}
Delete admin records from game server
To delete admin records from the Game Server, follow these steps:
Delete Admin Game Records
- Unreal Engine
- Unity
- Python Extend SDK
- Java Extend SDK
- C# Extend SDK
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
}));
ServerCloudSave serverCloudSave = AccelByteSDK.GetServerRegistry().GetApi().GetCloudSave();
string key = "SomeCloudSaveKey";
serverCloudSave.DeleteAdminGameRecord(key, result =>
{
if (result.IsError)
{
// Do something if DeleteAdminGameRecord fails
Debug.Log($"Error DeleteAdminGameRecord, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
return;
}
// Do something if DeleteAdminGameRecord succeeds
});
import accelbyte_py_sdk.api.cloudsave as cloudsave_service
import accelbyte_py_sdk.api.cloudsave.models as cloudsave_models
result, error = cloudsave_service.admin_delete_game_record_handler_v1(
key="SomeCloudSaveKey",
)
if error:
exit(error)
final AdminGameRecord adminGameRecordWrapper = new AdminGameRecord(sdk);
String key = "someKey";
try {
adminGameRecordWrapper.adminDeleteGameRecordHandlerV1(AdminDeleteGameRecordHandlerV1.builder()
.namespace("<namespace>")
.key(key)
.build());
} catch (Exception e) {
// Do something when failed
return;
}
string key = "someKey";
sdk.Cloudsave.AdminGameRecord.AdminDeleteGameRecordHandlerV1Op
.Execute(key, sdk.Namespace);
Delete admin player records
- Unreal Engine
- Unity
- Go Extend SDK
- Python Extend SDK
- Java Extend SDK
- C# Extend SDK
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
}));
ServerCloudSave serverCloudSave = AccelByteSDK.GetServerRegistry().GetApi().GetCloudSave();
string userId = "SomeUserId";
string key = "SomeCloudSaveKey";
serverCloudSave.DeleteAdminUserRecord(key, userId, result =>
{
if (result.IsError)
{
// Do something if DeleteAdminUserRecord fails
Debug.Log($"Error DeleteAdminUserRecord, Error Code: {result.Error.Code} Error Message: {result.Error.Message}");
return;
}
// Do something if DeleteAdminUserRecord succeeds
});
adminPlayerRecordService := &cloudsave.AdminPlayerRecordService{
Client: factory.NewCloudsaveClient(&repository.ConfigRepositoryImpl{}),
TokenRepository: &repository.TokenRepositoryImpl{},
}
key := "characterLocation"
namespace := "mygame"
userId := "myuserid"
input := &admin_player_record.AdminDeletePlayerRecordHandlerV1Params{
Key: key,
Namespace: namespace,
UserID: userId,
}
err := adminPlayerRecordService.AdminDeletePlayerRecordHandlerV1Short(input)
import accelbyte_py_sdk.api.cloudsave as cloudsave_service
import accelbyte_py_sdk.api.cloudsave.models as cloudsave_models
result, error = cloudsave_service.admin_delete_player_record_handler_v1(
key="SomeCloudSaveKey",
user_id="********************************",
)
if error:
exit(error)
AdminPlayerRecord adminPlayerRecordWrapper = new AdminPlayerRecord(sdk);
String key = "playerInformation";
String userId = "<user-id>";
try {
adminPlayerRecordWrapper.adminDeletePlayerRecordHandlerV1(AdminDeletePlayerRecordHandlerV1.builder()
.namespace("<namespace>")
.userId(userId)
.key(key)
.build());
} catch (Exception e) {
// Do something when failed
return;
}
string key = "characterLocation";
string userId = "<user-id>";
sdk.Cloudsave.AdminPlayerRecord.AdminDeletePlayerRecordHandlerV1Op
.Execute(key, sdk.Namespace, userId);