ReadEntity
Method reads an existing entity from the server.
Service | Operation |
---|---|
globalEntity | READ |
Method Parameters
Parameter | Description |
---|---|
entityId | The id of the entity |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
string entityId = "a-entity-id";
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.ReadEntity(entityId, successCallback, failureCallback);
const char *entityId = "a-entity-id";
_bc->getGlobalEntityService()->readEntity(entityId, this);
NSString *entityId = @"a-entity-id";
BCCompletionBlock successBlock; // define callback
BCErrorCompletionBlock failureBlock; // define callback
[[_bc globalEntityService] readEntity:entityId
completionBlock:successBlock
errorCompletionBlock:failureBlock
cbObject:nil];
String entityId = "a-entity-id";
this; // implements IServerCallback
_bc.getGlobalEntityService().readEntity(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 entityId = "a-entity-id";
_bc.globalEntity.readEntity(entityId, result =>
{
var status = result.status;
console.log(status + " : " + JSON.stringify(result, null, 2));
});
var entityId = "a-entity-id";
ServerResponse result = await _bc.globalEntityService.readEntity(entityId:entityId);
if (result.statusCode == 200) {
print("Success");
} else {
print("Failed ${result.error['status_message'] ?? result.error}");
}
var entityId = "a-entity-id";
var globalEntityProxy = bridge.getGlobalEntityServiceProxy();
var postResult = globalEntityProxy.readEntity(entityId);
if (postResult.status == 200) {
// Success!
}
{
"service": "globalEntity",
"operation": "READ",
"data": {
"entityId": "the-entity-id"
}
}
JSON Response
{
"status": 200,
"data": {
"entityId": "14281c38-abf6-4ca2-8436-b2bdwas8d5a9a",
"ownerId": "784cc6c6-4569-4d75-bd10-62dwa8ae0218",
"entityType": "test",
"entityIndexedId" : "indexTest",
"version": 1,
"data": {
"testData": 1234
},
"acl": {
"other": 1
},
"expiresAt": 1449861422588,
"timeToLive": 34567,
"createdAt": 1449861388021,
"updatedAt": 1449861388021,
"_serverTime": 1637946319239
}
}