Skip to main content
Version: 5.7.0

GetRandomEntitiesMatching

Gets a list of up to maxReturn randomly selected custom entities from the server based on the entity type and where condition.

ServiceOperation
customEntityGET_RANDOM_ENTITIES_MATCHING

Method Parameters

ParameterDescription
entityTypeThe type of custom entity being retrieved.
whereJsonThe where clause, as JSON object.
maxReturnThe maximum number of entities to return.

Usage

http://localhost:3000
string entityType = "athletes";
string whereJson = "{\"data.position\":\"forward\"}";
int maxReturn = 2;

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.GetRandomEntitiesMatching(entityType, whereJson, maxReturn, successCallback, failureCallback);
JSON Response
{
"data": {
"entityList": [
{
"entityId": "8b34a18b-5846-45d4-a7b8-e65775ca1973",
"version": 1,
"acl": {
"other": 2
},
"ownerId": null,
"expiresAt": null,
"timeToLive": null,
"createdAt": 1602700646415,
"updatedAt": 1602700646415,
"entityType": "athletes",
"data": {
"firstName": "Super",
"surName": "Star",
"position": "forward",
"goals": 2,
"assists": 4
}
},
{
"entityId": "e3ea0e05-032f-4b46-86cf-0423f5a9da24",
"version": 1,
"acl": {
"other": 2
},
"ownerId": null,
"expiresAt": null,
"timeToLive": null,
"createdAt": 1602700650242,
"updatedAt": 1602700650242,
"entityType": "athletes",
"data": {
"firstName": "Super",
"surName": "Star",
"position": "forward",
"goals": 2,
"assists": 4
}
}
],
"_serverTime": 1637946319239,
"entityListCount": 2
},
"status": 200
}