const url = 'https://api.zentail.com/v1/report';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"label":"example","isExport":false,"data":"example","extension":"csv","overwriteWithBlank":false,"createNewProducts":false,"columnTypes":["example"],"delimiter":",","activeOnly":false,"insertOnly":false,"includeHeader":true,"exportForExcel":false,"filter":"example","headersOnly":false}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.zentail.com/v1/report \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "label": "example", "isExport": false, "data": "example", "extension": "csv", "overwriteWithBlank": false, "createNewProducts": false, "columnTypes": [ "example" ], "delimiter": ",", "activeOnly": false, "insertOnly": false, "includeHeader": true, "exportForExcel": false, "filter": "example", "headersOnly": false }'You can use this endpoint to create an import or an export. The parameters used in each case are different so definitely check out the model to see what each parameter is used for. Please note the prefixes ‘For exports only:’ and ‘For imports only:’.
Import
You’ll need to build a file that has a header row that describes the contents of the corresponding column. You can find a list of acceptable column headers here. For example, if you were importing a file to set the MSRP for a set of SKUs, the first column header would have to be ‘SKU’ and the second column header would be ‘MSRP’.
Export
If you don’t supply any columnTypes in your request, we will include all of the possible columns that can be exported. If you’d like to restrict the number of columns you can pass the column types as an array. You can find a list of acceptable column headers here. For example if you were trying to export the MSRP for SKUs you would send ["SKU", "MSRP"] in the columnType parameter.
You can also use filters to limit the results of a report. You can find find more information on how to build a filter query here
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Details of the report to be created
object
Assigns a label to this report.
If true, this is an export. Otherwise it’s an import.
For imports only: This should be a csv, xls, xlsx, xslsm, txt, or tsv file encoded in base 64 (e.g. base64_encode(data) in PHP).
For imports only: This tells us the type of file that was encoded in the data parameter.
For imports only: If set to true, blank values supplied in the upload , data will overwrite.
For imports only: If set to true, if a SKU doesn’t exist in zentail, we will create one.
For exports only: Use this field to provide the columns you’d like to export. You can find the columns eligible for export at here. If no columns are supplied, all the possible columns will be exported (there are lot!).
For exports only: We will use this delimiter to separate the data in the export.
For exports only: If set to true, export will only include active products.
For imports only: If set to true, report will only fill in blank data on Zentail. Any data that already exists on Zentail will not be overwritten by data in the file.
For exports only: If set to true, export will include a header
For exports only: If set to true, will export as an Excel file.
For exports only: Use this to pass in filters to restrict the products being exported. See how to write a filter formula here., we will create one.
For exports only: If true, this export will only have header rows.
Responses
Section titled “ Responses ”Success
object
If true, this is an export. Otherwise it’s an import.
Timestamp when the report was requested to be run.
Timestamp when the report was completed.
Array of the column headers in this report.
Total number of lines processed successfully.
Path to access the stored file. Use this to download an exported file when it is “COMPLETE”
Returns an error message if we ran into an error processing the report.
For imports only: If set to true, blank values supplied in the upload data will overwrite. NULL is equivalent to false.
For imports only: If set to true, if a SKU doesn’t exist in zentail we will create one. NULL is equivalent to false.
For exports only: If set to true, export will only include active products.
For imports only: If set to true, report will only fill in blank data on Zentail. Any data that already exists on Zentail will not be overwritten by data in the file.
For exports only: If set to true, export will include a header
For exports only: If set to true, will export as an Excel file.
For exports only: Use this to pass in filters to restrict the products being exported. See how to write a filter formula here.
For exports only: We will use this delimiter to separate the data in the export.
For exports only: If true, this export will only have header rows.
If this is null, then the report was created by the API.
Example
{ "isExport": false, "status": "PENDING", "overwriteWithBlank": false, "createNewProducts": false, "activeOnly": false, "insertOnly": false, "includeHeader": true, "exportForExcel": false, "delimiter": ",", "headersOnly": false}Bad Request
object
Example
{ "errorCode": 400}Permission Denied
object
Example
{ "errorCode": 403}Not Found
object
Example
{ "errorCode": 404}Zentail Error
object
Example
{ "errorCode": 500}Zentail Error
object
Example
{ "errorCode": 503}