SysGetRandomEntitiesMatching
Gets a list of up to maxReturn randomly selected custom entities from the server based on the entity type and where condition, bypassing ownership/ACL permissions checking.
Service | Operation |
---|---|
customEntity | SYS_GET_RANDOM_ENTITIES_MATCHING |
Method Parameters
Parameter | Description |
---|---|
entityType | The type of custom entity being retrieved. |
whereJson | The where clause, as JSON object. |
maxReturn | The maximum number of entities to return. |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
var entityType = "athletes";
var whereJson = {
"data.position": "forward"
};
var maxReturn = 2;
var customEntityProxy = bridge.getCustomEntityServiceProxy();
var postResult = customEntityProxy.sysGetRandomEntitiesMatching(entityType, whereJson, maxReturn);
if (postResult.status == 200) {
// Success!
}
{
"service": "customEntity",
"operation": "SYS_GET_RANDOM_ENTITIES_MATCHING",
"data": {
"entityType": "athletes",
"whereJson": {
"data.position": "forward"
},
"maxReturn": 2
}
}
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
}
}
],
"entityListCount": 2
},
"status": 200
}