Skip to main content
Version: 5.7.0

IncrementDataSharded

Increments the specified fields by the specified amount within custom entity data on the server, enforcing ownership/ACL permissions.

ServiceOperation
customEntityINCREMENT_DATA_SHARDED

Method Parameters

ParameterDescription
entityTypeThe type of custom entity being updated.
entityIdThe id of custom entity being updated.
fieldsJsonSpecific fields, as JSON, within entity's custom data, with respective increment amount.
shardKeyJsonThe shard key field(s) and value(s), as JSON, applicable to the entity being updated. If entity is owned, ownerId must be specified in the shardKeyJson info; otherwise, shardKeyJson must indicate values for all fields in the applicable shard key index.

Usage

http://localhost:3000
string entityType = "athletes";
string entityId = "aaaa-bbbb-cccc-dddd";
string fieldsJson = "{ \"goals\": 3, \"assists\": 5 }";
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.IncrementDataSharded(entityType, entityId, fieldsJson, shardKeyJson, successCallback, failureCallback);
JSON Response
{
"data": {
"timeToLive": null,
"createdAt": 1659108750204,
"data": {
"goals": 6,
"assists": 10
},
"entityType": "athletes3",
"entityId": "d40569f4-c3b6-4d9e-89b2-ad5dbe4ba580",
"acl": {
"other": 2
},
"ownerId": "b015eabb-b0e2-42fb-9ad2-76aa2d7492f8",
"version": 2,
"expiresAt": null,
"updatedAt": 1659986804804
},
"status": 200
}