Skip to main content
Version: 5.7.0

UpdateEntityFieldsSharded

For sharded custom collection entities. Sets the specified fields within custom entity data on the server, enforcing ownership/ACL permissions.

ServiceOperation
customEntityUPDATE_ENTITY_FIELDS_SHARDED

Method Parameters

ParameterDescription
entityTypeThe type of custom entity being updated.
entityIdThe id of custom entity being updated.
versionVersion of the custom entity being updated.
fieldsJsonSpecific fields, as JSON, to set within entity's custom data.
shardKeyJsonThe shard key field(s) and value(s), as JSON, applicable to the entity being updated.

Usage

http://localhost:3000
string entityType = "athletes";
string entityId = "aaaa-bbbb-cccc-dddd";
int version = 1;
string fieldsJson = "{ \"stats.gamesPlayedTotal\": 2, \"stats.goalsTotal\": 2, \"games.played\": [ { \"date\": \"2022-01-21\", \"goals\": 1, \"assists\": 1, \"penalties\": 0 }, { \"date\": \"2022-01-10\", \"goals\": 1, \"assists\": 0, \"penalties\": 1 } ] }";
string shardKeyJson = "{ \"ownerId\": \"profileIdOfEntityOwner\" }";
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.UpdateEntityFieldsSharded(entityType, entityId, version, fieldsJson, shardKeyJson, successCallback, failureCallback);
JSON Response
{
"data": {
"timeToLive": null,
"createdAt": 1643144091464,
"entityType": "athletes",
"entityId": "bc7ea530-c6bd-4a27-bb5d-ced287991c87",
"acl": {
"other": 2
},
"ownerId": "b85f195e-b65f-4220-b84f-260e42b01c5b",
"version": 4,
"expiresAt": null,
"updatedAt": 1643213839419
},
"status": 200
}