Purpose
The delete operation in JQL is used to remove existing resources from Antly’s backend system. This operation allows you to specify a resource to be permanently deleted based on a unique identifier. The delete operation is essential for managing data lifecycle, ensuring that outdated, incorrect, or unnecessary records can be efficiently removed from the system.
Syntax
The JSON structure for a delete operation in JQL typically includes the following components:
__meta__: Metadata about the query, including authentication details, the intent (deleteOne), the target namespace, the schema, and the unique identifier of the resource to be deleted.
General Delete Operation Structure:
{
"__meta__": {
"authenticationClass": "<authentication_method>",
"intent": "deleteOne",
"namespace": "<module_name>",
"schema": "<schema_type>",
"uniqueObject": {
"id": "<instance_id>" // Identifier of the resource to be deleted
}
}
}
Example: Sample Query
Let's assume we are deleting a specific vehicle in the fleet.Vehicle namespace. The query would look like this:
{
"__meta__": {
"authenticationClass": "jwt",
"intent": "deleteOne",
"namespace": "fleet.Vehicle",
"schema": "model",
"uniqueObject": {
"id": "67890" // The ID of the vehicle to be deleted
}
}
}
In this example:
authenticationClass: Indicates that JWT token authentication is used.intent: Specifies the operation asdeleteOne.namespace: Targets thefleet.Vehiclemodule.schema: Indicates that the operation is on themodelschema.uniqueObject: Specifies the unique identifier (id) of the vehicle to be deleted.
Example: Sample Response
Upon successful execution of the delete operation, the response might look like this:
{
"status": "OK",
"data": null, // No data returned for delete operations
"errors": null,
"il8n": "en-gb",
"extras": {
"filtered": 1,
"display": 0,
"queries": 1
},
"system_info": null,
"intent": "deleteOne",
"message": "Vehicle deleted successfully."
}
In this response:
status: Indicates that the operation was successful (OK).data: Isnullbecause delete operations do not return data.errors: Will benullif no errors occurred.il8n: Specifies the locale used (en-gb).extras: Provides additional details about the operation, such as the number of filtered and displayed results.intent: Reflects the intent of the operation (deleteOne).message: Provides a human-readable message indicating the success of the operation.