Exports results of DQL or Bulk Enhance APIs requests to a CSV, XLS or XSLX file
You can export DQL Search and Bulk Enhance results in columnar format as CSV, XLS or XSLX files by specifying format=csv, format=xls or format=xlsx query parameters.
Additionally, exporting data in columnar format requires specifying an exportspec parameter which specifies how to export the entity JSON as columns.
Export Spec format
A simple export spec looks like this:
name,Name
The above export spec exports 1 column: Name is specified by $.name,Name
In general, a column in the export spec can be specified in the form field-name,custom-name,num-values. Only  field-name is mandatory.
field-name- the path to the field. You can use a simple dot notationskills.nameor JsonPath spec to specify the field name such as$.name. For more advanced options, see JsonPath Filtering.custom-name- the column name to export. If not specified, it defaults to the value offield-name.num-values- for multi-value fields (JSON arrays), this specifies the number of values to include in the output. The special valueallincludes all values. For example,allNames,Names,2orallNames,Names,all.
Multiple columns can be exported with a semicolon-delimited list of export specs. For example:
name,Name;summary,Summary;skills.name,Skills;
Or, using JSONPath
$.name,Name;$.summary,Summary;$.skills.name,Skills;
Export Spec examples
Here are some examples to get you started.
Export fields with default field names
Export name and homepageUri. Column names are not specified so they are the same as field name:
$.name;$.homepageUri
Export fields with custom field names
Export name as Name, ceo.name as CEO Name and summary as Summary columns:
$.name,Name;$.ceo.name,CEO Name;$.summary,Summary;
Export multi-value fields
Export all values of diffbotClassification.name as comma separated values:
name,Name;diffbotClassification.name,Classification,all
or using JSONPath as:
$.name,Name;$.diffbotClassification[*].name,Classification,all
For multi-value fields, the default separator is a comma (
,). You can specify a different separator using theexportseparatorquery parameter.
Enhance specific options
Getting query parameters and score
You can specify special paths in the exportspec parameter's filter specification to export the Enhance query fields and score.
Query info can be accessed using:
#score#query.id#query.type#query.name#query.url#query.location#query.phone#query.email#query.employer#query.title#query.school
Here is an example of exportspec using these special paths:
#query.type,Query Type;#query.name,Query Name;#score,Score;name,Name;homepageUri,Homepage;ceo.name,CEO;industries,Industries;summary,Summary;nbEmployeesMax,Employees;location.address,Address;location.city.name,City