DeleteSingleton
Method deletes the given singleton on the server.
Singletons are defined by their entity type, so no two singletons of the same type can exist at once.
This method is affected by versioning. See the versioning documentation for more information.
Service | Operation |
---|---|
entity | DELETE_SINGLETON |
Method Parameters
Parameter | Description |
---|---|
entityType | The entity type as defined by the user |
version | The version of the entity to delete. Use -1 to indicate the newest version |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
string entityType = "settings";
int version = -1;
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.EntityService.DeleteSingleton(entityType, version, successCallback, failureCallback);
const char *entityType = "settings";
int version = -1;
_bc->getEntityService()->deleteSingleton(entityType, version, this);
NSString *entityType = @"settings";
int version = -1;
BCCompletionBlock successBlock; // define callback
BCErrorCompletionBlock failureBlock; // define callback
[[_bc entityService] deleteSingleton:entityType
version:version
completionBlock:successBlock
errorCompletionBlock:failureBlock
cbObject:nil];
String entityType = "settings";
int version = -1;
this; // implements IServerCallback
_bc.getEntityService().deleteSingleton(entityType, version, 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 = "settings";
var version = -1;
_bc.entity.deleteSingleton(entityType, version, result =>
{
var status = result.status;
console.log(status + " : " + JSON.stringify(result, null, 2));
});
var entityType = "settings";
var version = -1;
ServerResponse result = await _bc.entityService.deleteSingleton(entityType:entityType, version:version);
if (result.statusCode == 200) {
print("Success");
} else {
print("Failed ${result.error['status_message'] ?? result.error}");
}
var entityType = "settings";
var version = -1;
var entityProxy = bridge.getEntityServiceProxy();
var postResult = entityProxy.deleteSingleton(entityType, version);
if (postResult.status == 200) {
// Success!
}
{
"service": "entity",
"operation": "DELETE_SINGLETON",
"data": {
"entityType": "settings",
"version": -1
}
}
JSON Response
{
"status": 200,
"data": null
}
Common Error Code
Status Codes
Code | Name | Description |
---|---|---|
40344 | ENTITY_VERSION_MISMATCH | The version parameter does not match the current version on the server |