Skip to main content
Version: 5.7.0

CreateEntity

Creates a new custom entity.

ServiceOperation
customEntityCREATE_ENTITY

Method Parameters

ParameterDescription
entityTypeThe type of custom entity to create.
dataJsonThe entity's custom field data, as JSON.
aclThe 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 custom entity should live before being expired. Null indicates never expires.
isOwnedBoolean to indicate whether the current user should be recorded as the owner of the object. If owned, the object will be automatically deleted if/when the user is deleted.

Usage

http://localhost:3000
string entityType = "athletes";
string dataJson = "{\"firstName\":\"Super\",\"surName\":\"Star\",\"position\":\"forward\",\"goals\":2,\"assists\":4}";
string acl = "{\"other\":1}";
int timeToLive = null;
bool isOwned = false;
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.CreateEntity(entityType, dataJson, acl, timeToLive, isOwned, successCallback, failureCallback);
JSON Response
{
"status": 200,
"data": {
"entityId": "8469e360-0b24-4c87-xxxx-89fd0e3ee436",
"version": 1,
"acl": {
"other": 1
},
"ownerId": null,
"expiresAt": null,
"timeToLive": null,
"createdAt": 1573532801958,
"updatedAt": 1573532801958
}
}