Skip to main content
Version: 5.7.0

CreateEntity

Method creates a new entity on the server.

ServiceOperation
globalEntityCREATE

Method Parameters

ParameterDescription
entityTypeThe entity type as defined by the user
timeToLiveSets expiry time for entity in milliseconds if > 0
jsonEntityAclThe entity's Access Control List as object. A null ACL implies default permissions which make the entity readable/writeable by only the user.
jsonEntityDataThe entity's data object

Usage

http://localhost:3000
string entityType = "address";
ACL acl = new ACL(ACL.Access.None);
string jsonEntityAcl = "{\"other\":1}";
string jsonEntityData = "{\"street\":\"1309 Carling\"}";
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.GlobalEntityService.CreateEntity(entityType, timeToLive, jsonEntityAcl, jsonEntityData, successCallback, failureCallback);
JSON Response
{
"data": {
"gameId": "12832",
"entityId": "e75f4304-2af3-42eb-8e10-ba419cd224d1",
"ownerId": "3b284d94-cbdf-43a7-9239-34d45aa27720",
"entityType": "address",
"entityIndexedId": null,
"version": 1,
"acl": {
"other": 1
},
"expiresAt": 9223372036854776000,
"timeToLive": -1,
"createdAt": 1582645167040,
"updatedAt": 1582645167040
},
"status": 200
}