Skip to main content
Version: 5.7.0

UpdateSingleton

Updates the singleton owned by the user for the specified custom entity type on the server, creating the singleton if it does not exist. This operation results in the owned singleton's data being completely replaced by the passed in JSON object.

ServiceOperation
customEntityUPDATE_SINGLETON

Method Parameters

ParameterDescription
entityTypeThe type of custom entity singleton to create/update. Custom entity type must have option isOwned set to true.
versionVersion of the custom entity singleton being updated.
dataJsonThe singleton entity's custom field data, as JSON.
aclThe singleton entity's Access Control List as an object. A null ACL implies default permissions which make the entity readable by others.
timeToLiveThe duration of time, in milliseconds, the singleton custom entity should live before being expired. Null indicates never expires. Value of -1 indicates no change for updates.

Usage

http://localhost:3000
string entityType = "athletes";
int version = 1;
string dataJson = "{\"firstName\":\"Super\",\"surName\":\"Star\",\"position\":\"defense\",\"goals\":3,\"assists\":5}";
string acl = "{\"other\":1}";
int timeToLive = null;
SuccessCallback successCallback = (response, cbObject) =>
{
Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
Debug.Log(string.Format("Failed | {0} {1} {2}", status, code, error));
};

_bc.CustomEntityService.UpdateSingleton(entityType, version, dataJson, acl, timeToLive, successCallback, failureCallback);
JSON Response
{
"data": {
"timeToLive": null,
"version": 2,
"expiresAt": null,
"updatedAt": 1591820239028
},
"status": 200
}