ReadEntity
Reads a custom entity.
Service | Operation |
---|---|
customEntity | READ_ENTITY |
Method Parameters
Parameter | Description |
---|---|
entityType | The type of custom entity being read. |
entityId | The id of custom entity being read. |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
string entityType = "athletes";
string entityId = "aaaa-bbbb-cccc-dddd";
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.ReadEntity(entityType, entityId, successCallback, failureCallback);
const char *entityType = "athletes";
const char *entityId = "aaaa-bbbb-cccc-dddd";
_bc->getCustomEntityService()->readEntity(entityType, entityId, this);
NSString *entityType = @"athletes";
NSString *entityId = @"aaaa-bbbb-cccc-dddd";
BCCompletionBlock successBlock; // define callback
BCErrorCompletionBlock failureBlock; // define callback
[[_bc customEntityService] readEntity:entityType
entityId:entityId
completionBlock:successBlock
errorCompletionBlock:failureBlock
cbObject:nil];
String entityType = "athletes";
String entityId = "aaaa-bbbb-cccc-dddd";
this; // implements IServerCallback
_bc.getCustomEntityService().readEntity(entityType, entityId, this);
public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
{
System.out.print(String.format("Success | %s", jsonData.toString()));
}
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
{
System.out.print(String.format("Failed | %d %d %s", statusCode, reasonCode, jsonError.toString()));
}
var entityType = "athletes";
var entityId = "aaaa-bbbb-cccc-dddd";
_bc.customEntity.readEntity(entityType, entityId, result =>
{
var status = result.status;
console.log(status + " : " + JSON.stringify(result, null, 2));
});
var entityType = "athletes";
var entityId = "aaaa-bbbb-cccc-dddd";
ServerResponse result = await _bc.customEntityService.readEntity(entityType:entityType, entityId:entityId);
if (result.statusCode == 200) {
print("Success");
} else {
print("Failed ${result.error['status_message'] ?? result.error}");
}
var entityType = "athletes";
var entityId = "aaaa-bbbb-cccc-dddd";
var customEntityProxy = bridge.getCustomEntityServiceProxy();
var postResult = customEntityProxy.readEntity(entityType, entityId);
if (postResult.status == 200) {
// Success!
}
{
"service": "customEntity",
"operation": "READ_ENTITY",
"data": {
"entityType": "athletes",
"entityId": "aaaa-bbbb-cccc-dddd"
}
}
JSON Response
{
"status": 200,
"data": {
"entityId": "f9d91cda-3ece-447c-xxxx-046fa026520c",
"version": 1,
"acl": {
"other": 1
},
"ownerId": null,
"expiresAt": null,
"timeToLive": null,
"createdAt": 1573537595505,
"updatedAt": 1573537595505,
"entityType": "athletes",
"data": {
"firstName": "Super",
"surName": "Star",
"position": "forward",
"goals": 2,
"assists": 4
},
"_serverTime": 1637946319239
}
}