Delete Data Object
curl --request DELETE \
--url https://api.pretectum.io/v1/businessareas/{businessAreaId}/schemas/{schemaId}/datasets/{datasetId}/dataobjects/{dataObjectId} \
--header 'Authorization: <authorization>'import requests
url = "https://api.pretectum.io/v1/businessareas/{businessAreaId}/schemas/{schemaId}/datasets/{datasetId}/dataobjects/{dataObjectId}"
headers = {"Authorization": "<authorization>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: '<authorization>'}};
fetch('https://api.pretectum.io/v1/businessareas/{businessAreaId}/schemas/{schemaId}/datasets/{datasetId}/dataobjects/{dataObjectId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pretectum.io/v1/businessareas/{businessAreaId}/schemas/{schemaId}/datasets/{datasetId}/dataobjects/{dataObjectId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.pretectum.io/v1/businessareas/{businessAreaId}/schemas/{schemaId}/datasets/{datasetId}/dataobjects/{dataObjectId}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.pretectum.io/v1/businessareas/{businessAreaId}/schemas/{schemaId}/datasets/{datasetId}/dataobjects/{dataObjectId}")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pretectum.io/v1/businessareas/{businessAreaId}/schemas/{schemaId}/datasets/{datasetId}/dataobjects/{dataObjectId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_bodyData Objects
Delete Data Object
Delete a data object (record) from a dataset
DELETE
/
v1
/
businessareas
/
{businessAreaId}
/
schemas
/
{schemaId}
/
datasets
/
{datasetId}
/
dataobjects
/
{dataObjectId}
Delete Data Object
curl --request DELETE \
--url https://api.pretectum.io/v1/businessareas/{businessAreaId}/schemas/{schemaId}/datasets/{datasetId}/dataobjects/{dataObjectId} \
--header 'Authorization: <authorization>'import requests
url = "https://api.pretectum.io/v1/businessareas/{businessAreaId}/schemas/{schemaId}/datasets/{datasetId}/dataobjects/{dataObjectId}"
headers = {"Authorization": "<authorization>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: '<authorization>'}};
fetch('https://api.pretectum.io/v1/businessareas/{businessAreaId}/schemas/{schemaId}/datasets/{datasetId}/dataobjects/{dataObjectId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pretectum.io/v1/businessareas/{businessAreaId}/schemas/{schemaId}/datasets/{datasetId}/dataobjects/{dataObjectId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.pretectum.io/v1/businessareas/{businessAreaId}/schemas/{schemaId}/datasets/{datasetId}/dataobjects/{dataObjectId}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.pretectum.io/v1/businessareas/{businessAreaId}/schemas/{schemaId}/datasets/{datasetId}/dataobjects/{dataObjectId}")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pretectum.io/v1/businessareas/{businessAreaId}/schemas/{schemaId}/datasets/{datasetId}/dataobjects/{dataObjectId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_bodyThe Delete Data Object endpoint allows you to remove a record from a dataset. Deleted records are marked as deleted rather than permanently removed, allowing for potential recovery and audit trail maintenance.
Prerequisites
- A Pretectum API key (see API Keys)
- Permission to delete data objects in your tenant
- Valid business area ID (see List Business Areas)
- Valid schema ID (see List Schemas)
- Valid dataset ID (see List Datasets)
- Valid data object ID (from List Data Objects)
Authentication
Include your API key in theAuthorization header.
Authorization: pre_your_api_key
Request
Path Parameters
string
required
The unique identifier of the business area. You can obtain this from the List Business Areas endpoint.
string
required
The unique identifier of the schema. You can obtain this from the List Schemas endpoint.
string
required
The unique identifier of the dataset. You can obtain this from the List Datasets endpoint.
string
required
The unique identifier of the data object to delete. You can obtain this from the List Data Objects endpoint.
Headers
string
required
Your Pretectum API key. Create one in the Pretectum app under Configuration → API Keys.
string
default:"application/json"
The response content type. Currently only
application/json is supported.Example Requests
curl -X DELETE "https://api.pretectum.io/v1/businessareas/20240115103000123a1b2c3d4e5f6789012345678901234/schemas/20240115103000456d1e2f3a4b5c6789012345678901234/datasets/20240925152201042a1b2c3d4e5f6789012345678901234/dataobjects/20240601120000123f1a2b3c4d5e6789012345678901234" \
-H "Authorization: pre_your_api_key" \
-H "Accept: application/json"
const apiKey = 'pre_your_api_key';
const businessAreaId = '20240115103000123a1b2c3d4e5f6789012345678901234';
const schemaId = '20240115103000456d1e2f3a4b5c6789012345678901234';
const datasetId = '20240925152201042a1b2c3d4e5f6789012345678901234';
const dataObjectId = '20240601120000123f1a2b3c4d5e6789012345678901234';
async function deleteDataObject(businessAreaId, schemaId, datasetId, dataObjectId) {
const response = await fetch(
`https://api.pretectum.io/v1/businessareas/${businessAreaId}/schemas/${schemaId}/datasets/${datasetId}/dataobjects/${dataObjectId}`,
{
method: 'DELETE',
headers: {
'Authorization': apiKey,
'Accept': 'application/json'
}
}
);
if (!response.ok) {
throw new Error(`Failed to delete data object: ${response.statusText}`);
}
// Returns 204 No Content on success
return response.status === 204;
}
const success = await deleteDataObject(businessAreaId, schemaId, datasetId, dataObjectId);
if (success) {
console.log('Data object deleted successfully');
}
import requests
api_key = 'pre_your_api_key'
business_area_id = '20240115103000123a1b2c3d4e5f6789012345678901234'
schema_id = '20240115103000456d1e2f3a4b5c6789012345678901234'
dataset_id = '20240925152201042a1b2c3d4e5f6789012345678901234'
data_object_id = '20240601120000123f1a2b3c4d5e6789012345678901234'
def delete_data_object(business_area_id, schema_id, dataset_id, data_object_id):
response = requests.delete(
f'https://api.pretectum.io/v1/businessareas/{business_area_id}/schemas/{schema_id}/datasets/{dataset_id}/dataobjects/{data_object_id}',
headers={
'Authorization': api_key,
'Accept': 'application/json'
}
)
response.raise_for_status()
# Returns 204 No Content on success
return response.status_code == 204
success = delete_data_object(business_area_id, schema_id, dataset_id, data_object_id)
if success:
print('Data object deleted successfully')
Response
A successful deletion returns a204 No Content response with no body.
Success Response
HTTP/1.1 204 No Content
The
204 No Content response indicates the deletion was successful. The data object is marked as deleted and will no longer appear in list operations.Error Responses
| Status Code | Description |
|---|---|
401 Unauthorized | The API key is missing, malformed, unknown, inactive, expired or deleted. Check the key in Configuration → API Keys. |
403 Forbidden | Your application client does not have permission to delete data objects. Contact your tenant administrator. |
404 Not Found | The specified business area, schema, dataset, or data object does not exist, or you do not have access to it. |
409 Conflict | The data object was being modified by another request at the same moment (DATA_OBJECT_CONCURRENT_MODIFICATION). Nothing was deleted; retry the request. |
500 Internal Server Error | An unexpected error occurred on the server. Try again later or contact support. |
Soft Delete
Pretectum uses soft delete for data objects:- Records are marked as deleted (
deleted: true) rather than permanently removed. - Deleted records are excluded from list operations and search results.
- This approach maintains data integrity for audit trails and allows potential recovery.
Deletion is a sensitive operation. Ensure you have proper confirmation workflows in place before deleting data objects, especially in production environments.
Batch Deletion
To delete multiple data objects, call the delete endpoint for each object. For better performance with large batches, consider running deletions in parallel:async function deleteMultipleDataObjects(businessAreaId, schemaId, datasetId, dataObjectIds) {
const results = await Promise.allSettled(
dataObjectIds.map(id =>
deleteDataObject(businessAreaId, schemaId, datasetId, id)
)
);
const succeeded = results.filter(r => r.status === 'fulfilled' && r.value).length;
const failed = results.filter(r => r.status === 'rejected' || !r.value).length;
console.log(`Deleted ${succeeded} objects, ${failed} failed`);
return { succeeded, failed };
}
const idsToDelete = [
'20240601120000123f1a2b3c4d5e6789012345678901234',
'20240601120100456g2b3c4d5e6f7890123456789012345',
'20240601120200789h3c4d5e6f7g8901234567890123456'
];
await deleteMultipleDataObjects(businessAreaId, schemaId, datasetId, idsToDelete);
import asyncio
import aiohttp
async def delete_data_object_async(session, business_area_id, schema_id, dataset_id, data_object_id):
url = f'https://api.pretectum.io/v1/businessareas/{business_area_id}/schemas/{schema_id}/datasets/{dataset_id}/dataobjects/{data_object_id}'
async with session.delete(url, headers={'Authorization': api_key}) as response:
return response.status == 204
async def delete_multiple_data_objects(business_area_id, schema_id, dataset_id, data_object_ids):
async with aiohttp.ClientSession() as session:
tasks = [
delete_data_object_async(session, business_area_id, schema_id, dataset_id, id)
for id in data_object_ids
]
results = await asyncio.gather(*tasks, return_exceptions=True)
succeeded = sum(1 for r in results if r is True)
failed = len(results) - succeeded
print(f"Deleted {succeeded} objects, {failed} failed")
return {'succeeded': succeeded, 'failed': failed}
ids_to_delete = [
'20240601120000123f1a2b3c4d5e6789012345678901234',
'20240601120100456g2b3c4d5e6f7890123456789012345',
'20240601120200789h3c4d5e6f7g8901234567890123456'
]
asyncio.run(delete_multiple_data_objects(business_area_id, schema_id, dataset_id, ids_to_delete))
Best Practices
- Confirm before deleting: Implement confirmation dialogs or double-check logic before executing deletions.
- Log deletions: Maintain a record of what was deleted, when, and by whom for audit purposes.
- Handle errors gracefully: Not-found errors may indicate the object was already deleted.
- Consider permissions: Ensure only authorized users can delete data objects.
- Test in non-production first: Verify your deletion logic in a test environment before running in production.
Related Endpoints
List Data Objects
Retrieve records from a dataset
Create Data Object
Add new records to a dataset
Update Data Object
Modify existing records
Search Data Objects
Search across all datasets
