Skip to main content
Version: 5.7.0

CreateEntityWithIndexedId

Method creates a new entity on the server with an indexed ID.

ServiceOperation
globalEntityCREATE_WITH_INDEXED_ID

Method Parameters

ParameterDescription
entityTypeThe entity type as defined by the user
indexedIdA secondary ID that will be indexed
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";
string indexedId = "entityId1";
int timeToLive = -1;
ACL jsonEntityAcl = new ACL(ACL.Access.None);
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.CreateEntityWithIndexedId(entityType, indexedId, timeToLive, jsonEntityAcl, jsonEntityData, successCallback, failureCallback);
JSON Response
{
"data": {
"gameId": "123456",
"entityId": "14281c38-abf6-4ca2-8436-b2bdwas8d5a9a",
"ownerId": "784cc6c6-4569-4d75-bd10-62dwa8ae0218",
"entityType": "test",
"entityIndexedId" : "indexTest",
"version": 1,
"acl": {
"other": 1
},
"expiresAt": 1449861422588,
"timeToLive": 34567,
"createdAt": 1449861388021,
"updatedAt": 1449861388021
},
"status": 200
}