Skip to main content

Export Deleted Data

Zuora
  • 日本語のコンテンツは機械翻訳されており、補助的な参照を目的としています。機械翻訳の精度は保証できません。英語版が正となります。また、現時点では検索機能は日本語での検索をサポートしていません。翻訳に関するフィードバックについては、docs@zuora.comに送信してください。

Export Deleted Data

AQuA API is subject to Zuora Data Retention Policy. The retention period of deleted data is 30 days. You can only retrieve deleted data for 30 days through AQuA.

This article describes how to export deleted data in stateful mode. To export deleted data in stateless mode, see Extract deleted data in each query.

Zuora highly recommends you use the stateless mode instead of the stateful mode to extract bulk data. See Bulk data extraction from Zuora using AQuA for best practices.

Starting with version 1.1, the AQuA API supports the exporting of deleted records in Stateful mode.

In Stateful mode, the first request executes queries against all data in the database and returns all data that satisfies the query criteria. Deleted records are not included in the export. 

Subsequent requests execute the queries against incremental data created or updated since the previous AQuA session. Subsequent requests can also execute the queries against data that has been deleted since the previous AQuA session. To include deleted records in an export, set the deleted field in the request body when making the request.

When you export data that includes deleted records, the export has an additional column that indicates whether each record is a deleted record. You can specify the name and format of this additional column.

Limitations

  • The following API objects do not support the exporting of deleted records:
    • PaymentTransactionLog
    • RefundTransactionLog
    • AccountingCode
    • AccountingPeriod
    • Processed Usage
  • The DiscountAppliedMetrics object does not support soft delete.
  • You cannot extract the records that were both created and deleted during the same interval between two consecutive incremental AQuA queries.

Request

Use the Submit an aggregate query job API operation with the queries > deleted parameter to export deleted data.

JSON Example

Example 1

This example shows how deleted records are not extracted for a full load, making the MyDeleted column = 0 or False for all the records.

  1. Submit a full load JSON request with the deleted column as numeric.

HTTP request:

POST https://rest.zuora.com/v1/batch-query/

POST https://apisandbox.zuora.com/v1/batch-query/

Download File:

01Account.MyDeleted,Account: ID,Account: Name,Account: Account Balance,Account: Tax Exempt Status,
02Account: Auto Pay,Account: Currency,Bill To: ID,Sold To: ID
030,40288187485e400101485e426c6f0d2c,name1410330684509,77.86,,false,USD,40288187485e400101485e426c760d2d,40288187485e400101485e426c7c0d2e
040,40288187485e400101485e426f770da8,name1410330685288,77.86,,false,USD,40288187485e400101485e426f7e0da9,
0540288187485e400101485e426f840daa
060,40288187485e400101485e4271fd0e08,name1410330685934,77.86,,false,USD,
0740288187485e400101485e4272040e09,40288187485e400101485e42720a0e0a
080,40288187485e400101485e42748e0e68,
09name1410330686592,77.86,,false,USD,40288187485e400101485e4274990e69,40288187485e400101485e4274a00e6a
100,40288187485e400101485e42772d0ec8,name1410330687262,77.86,,false,USD,40288187485e400101485e4277350ec9,
1140288187485e400101485e42773b0eca
120,40288187485e400101485e4279bb0f28,name1410330687915,77.86,,false,USD,
1340288187485e400101485e4279c20f29,40288187485e400101485e4279c90f2a
140,40288187485e400101485e427c4e0f88,name1410330688575,77.86,,false,USD,40288187485e400101485e427c550f89,40288187485e400101485e427c5b0f8a
150,40288187485e400101485e427ed60fe8,name1410330689222,77.86,,false,USD,40288187485e400101485e427edc0fe9,
1640288187485e400101485e427ee20fea
170,40288187485e400101485e4281821048,name1410330689905,77.86,,false,USD,
1840288187485e400101485e42818d1049,40288187485e400101485e428193104a
190,40288187485e400101485e42841e10a8,name1410330690570,77.86,,false,USD,40288187485e400101485e42842610a9,40288187485e400101485e42842c10aa
200,40288187485e400101485e42bfc81108,name1410330705849,0,,false,USD,40288187485e400101485e42bfcf1109,
2140288187485e400101485e42bfd5110a

Example 2

This example show how to delete an existing account and create a new account before an incremental load. This results in two records. The deleted account record has the deleted flag = 1 or True, and the newly created account record has the deleted flag = 0.

1. Submit an incremental JSON request.

HTTP request:

POST https://www.zuora/v1/batch-query/

POST https://apisandbox.zuora.com/v1/batch-query/

JSON request:

01{
02    "format": "csv",
03    "version": "1.1",
04    "name": "Example",
05    "encrypted": "none",
06    "partner": "salesforce",
07    "project": "00170000011K3Ub",
08    "queries": [
09        {
10            "name": "Account",
11            "query": "select Id,Name,Balance,TaxExemptStatus,AutoPay,Currency, BillToContact.Id, SoldToContact.Id  from  Account",
12            "type": "zoqlexport",
13            "apiVersion": "20.0",
14            "deleted": {
15                "column": "MyDeleted",
16                "format": "Numeric"
17            }
18        }
19    ]
20}

JSON response:

01{
02    "batches": [
03        {
04            "deleted": {
05                "column": "MyDeleted",
06                "format": "Numeric"
07            },
08            "full": false,
09            "name": "Account",
10            "query": "select Id,Name,Balance,TaxExemptStatus,AutoPay,Currency, BillToContact.Id, SoldToContact.Id  from  Account",
11            "status": "pending",
12            "recordCount": 0,
13            "apiVersion": "20.0",
14            "batchType": "zoqlexport",
15            "batchId": "4028818748597d2f01485fbe4d8d05db"
16        }
17    ],
18    "project": "00170000011K3Ub",
19    "partner": "salesforce",
20    "name": "Example",
21    "id": "4028818748597d2f01485fbe4d8805da",
22    "version": "1.1",
23    "format": "CSV",
24    "status": "submitted",
25    "encrypted": "none"
26}
  1. Get the job details

HTTP request:

GET https://www.zuora.com/v1/batch-query/jobs/4028818748597d2f01485fbe4d8805da

GET https://apisandbox.zuora.com/v1/batch-query/jobs/4028818748597d2f01485fbe4d8805da

JSON response:

01{
02    "batches": [
03        {
04            "deleted": {
05                "column": "MyDeleted",
06                "format": "Numeric"
07            },
08            "full": false,
09            "name": "Account",
10            "message": "",
11            "query": "select Id,Name,Balance,TaxExemptStatus,AutoPay,Currency, BillToContact.Id, SoldToContact.Id  from  Account",
12            "status": "completed",
13            "recordCount": 2,
14            "apiVersion": "20.0",
15            "fileId": "4028818748597d2f01485fbe4e1105dd",
16            "batchType": "zoqlexport",
17            "batchId": "4028818748597d2f01485fbe4d8d05db"
18        }
19    ],
20    "project": "00170000011K3Ub",
21    "partner": "salesforce",
22    "name": "Example",
23    "id": "4028818748597d2f01485fbe4d8805da",
24    "version": "1.1",
25    "format": "CSV",
26    "startTime": "2014-09-10 06:26:20",
27    "status": "completed",
28    "encrypted": "none"
  1. Retrieve the download file.

HTTP request:

GET https://www.zuora.com/v1/file/4028818748597d2f01485fbe4e1105dd

GET https://apisandbox.zuora.com/v1/file/4028818748597d2f01485fbe4e1105dd

Download file:

1Account.MyDeleted,Account: ID,Account: Name,Account: Account Balance,Account: Tax Exempt Status,
2Account: Auto Pay,Account: Currency,Bill To: ID,Sold To: ID
30,4028818748597d2f01485fbe171805d4,testIncremenatlLoad,0,No,false,USD,4028818748597d2f01485fbe172a05d5,
44028818748597d2f01485fbe172a05d5
51,40288187485e400101485e42841e10a8,name1410330690570,77.86,,false,USD,,