- 1 Minute to read
- Print
- DarkLight
- PDF
Clear Data (External Source Models)
- 1 Minute to read
- Print
- DarkLight
- PDF
Clear Data (External Source Models)
The Clear Data API clears existing data from an External Source Model based on the scope of the definition. When clearing data from an external source model, you can opt to clear specific data versus the entire model. To clear specific data, use filters. To clear all model data, use the API without filters. For example, you might opt to clear data for a specific period, a department, or a company.
This API works with both the legacy External Source Model functionality and the newest implementation of ESM.
The request is idempotent. Clear Data API will return success even if all data has been cleared in earlier call.
POST /modeling/sourcemodel/data/clear HTTP/1.1
Content-Type: application/xml
Accept: application/xml
X-ACCESS-TOKEN:
<clear-data-payload>
<model-name>$SourceModelName</model-name>
</clear-data-payload>
The syntax below provides example syntax to clear data for two fields (each of which have 3 values) from an external source model.
<clear-data-payload>
<model-name>$SourceModelName</model-name>
<filters>
<filter>
<field></field>
<field-value></field-value>
<field-value></field-value>
<field-value></field-value>
</filter>
<filter>
<field></field>
<field-value></field-value>
<field-value></field-value>
<field-value></field-value>
</filter>
</filters>
</clear-data-payload>
Parameters
$SourceModelName: (type: string) Name of the model in which data will be cleared
Sample Payload 1
<?xml version="1.0" encoding="UTF-8"?>
<clear-data-payload>
<model-name>My Model</model-name>
</clear-data-payload>
Sample Payload 2
The sample payload syntax below provides an example to clear data for month 1, 2, and 3 (Periods 1, 2, and 3) for the Sales and Marketing departments.
<?xml version="1.0" encoding="UTF-8"?>
<clear-data-payload>
<model-name>My external model</model-name>
<filters>
<filter>
<field>Department</field>
<field-value>Sales</field-value>
<field-value>Marketing</field-value>
</filter>
<filter>
<field>Period</field>
<field-value>Period1</field-value>
<field-value>Period2</field-value>
<field-value>Period3</field-value>
</filter>
</filters>
<notify-on-failure>
<email>john.doe@mycompany.com</email>
</notify-on-failure>
</clear-data-payload>
Response
Success Response
HTTP/1.1 200/204 OK
Error Responses
Service Not Available (possibly due to maintenance)
HTTP/1.1 503 Service Unavailable
One or more HTTP headers were missing
HTTP/1.1 412 Precondition Failed
Unauthorized Access (access key lookup failed)
HTTP/1.1 401 Unauthorized
Invalid XML (bad request)
HTTP/1.1 400 Bad Request
Not Found (source model not found)
HTTP/1.1 404 Not Found
See also Clear Data (Master and Analytic Models).