- 1 Minute to read
- Print
- DarkLight
- PDF
Export Leaf-Level Data (Scoped) (External Source Models)
- 1 Minute to read
- Print
- DarkLight
- PDF
Export Leaf-Level Data (Scoped) (External Source Models)
This API allows you to export leaf-level data from a specified external source model in XML format. Optionally, you can specify one or more filters to export specific data and you can specify which fields to export.
This API works with both the legacy External Source Model functionality and the newest implementation of ESM.
POST /modeling/sourcemodel/data/export HTTP/1.1
Content-Type: application/xml
Accept: application/xml
X-ACCESS-TOKEN: UUID
Request Payload
<?xml version="1.0" encoding="UTF-8"?>
<export-data-payload>
<model-name>$ModelName</model-name>
<delimiter>$Delimiter</delimiter>
<filters>
<filter>
<field>$FilterField</field>
<field-value>filter field value</field-value>
</filter>
</filters>
<fields>
<field>$FieldtoExport</field>
</fields>
</export-data-payload>
Parameters
$ModelName: (type: string) Name of the external source model. Mandatory.
$Delimiter: (type: string) Delimiter string. Mandatory.
$FilterField: (type: string) Name of the field to use in filtering which data is exported. Specify one or more rows of field values as the filters. Optional.
$FieldtoExport: (type: string) Name of the field to include in the exported XML file. Add additional rows for additional fields. If you do not include this section, then all the columns will be selected. Optional.
Sample Payload
The following example exports data from the external source model salestxn and uses a comma delimiter between fields in the exported XML file. Only records with the value "Kitchen" or "Apparel" in the "cat" (category) field are exported. The exported XML file contains four fields from the external source model.
<export-data-payload>
<model-name>salestxn</model-name>
<delimiter>,</delimiter>
<filters>
<filter>
<field>cat</field>
<field-value>Kitchen</field-value>
<field-value>Apparel</field-value>
</filter>
</filters>
<fields>
<field>txndate</field>
<field>item</field>
<field>price</field>
<field>total</field>
</fields>
</export-data-payload>
Response
<?xml version="1.0" encoding="UTF-8"?>
<export-data-payload>
<model-name>salestxn</model-name>
<delimiter>,</delimiter>
<filters>
<filter>
<field>cat</field>
<field-value>Kitchen</field-value>
<field-value>Apparel</field-value>
</filter>
</filters>
<fields>
<field>txndate</field>
<field>item</field>
<field>price</field>
<field>total</field>
</fields>
<records>
<record>2018/11/01,K0001,10.0,10.0</record>
<record>2018/11/01,K0001,10.0,10.0</record>
<record>2018/11/01,K0001,10.0,10.0</record>
<record>2018/11/01,K0001,10.0,10.0</record>
<record>2018/11/01,K0001,10.0,10.0</record>
<record>2018/11/01,K0001,10.0,10.0</record>
<record>2018/11/01,K0001,10.0,10.0</record>
<record>2018/11/01,K0001,10.0,10.0</record>
<record>2018/11/01,K0001,10.0,10.0</record>
<record>2018/11/01,K0001,10.0,10.0</record>
<record>2018/11/01,A0001,10.0,20.0</record>
<record>2018/11/01,A0001,10.0,20.0</record>
<record>2018/11/01,A0001,10.0,20.0</record>
<record>2018/11/01,A0001,10.0,20.0</record>
<record>2018/11/01,A0001,10.0,20.0</record>
<record>2018/11/01,A0001,15.0,15.0</record>
<record>2018/11/01,A0001,15.0,15.0</record>
<record>2018/11/01,A0001,15.0,15.0</record>
<record>2018/11/01,A0001,15.0,15.0</record>
<record>2018/11/01,A0001,15.0,15.0</record>
</records>
</export-data-payload>
Success Response
HTTP/1.1 200 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
Model not found or invalid field.
HTTP/1.1 401 Unauthorized
Unauthorized Access (access key lookup failed)
HTTP/1.1 401 Unauthorized
Invalid XML (bad request)
HTTP/1.1 400 Bad Request