/v1/data-files/customers/previewsReads a customers file (CSV, Excel or JSON) and says what importing it would do, row by row. Nothing is saved. A row with an id is that customer. A row with no id is the one customer of its name, or a new customer whose id is made from its name. Each row is new, changed, same or invalid; an invalid row names its column and why, and is not imported. A column the file has sets that field, and an empty cell clears it. A column the file lacks keeps what is saved. A customer the file leaves out is kept: an import never removes one. A file with a column no customer has is refused whole, naming the column. basedOn is the version of the list the preview was made against. Send it with the import.
Request body
application/json, required
- namestring
- datastring (byte)Required
The file as base64, at most 10 MB decoded.
Response
A 200 answer carries these fields.
- countsobjectRequired
Show 4 child fields
- newintegerRequired
- changedintegerRequired
- sameintegerRequired
- invalidintegerRequired
- rowsarray of objectRequired
Show 7 child fields
- rowintegerRequired
The row's line in the file
- statusstringRequiredOne of
new,changed,same,invalid. - idstring or nullRequired
- namestring or nullRequired
- columnstring
An invalid row's column.
- messagestring
Why an invalid row cannot be imported.
- reasonobject
Why an invalid row cannot be imported, as a code, the way an error's
reasonsays it;fieldis the row's column.Show 2 child fields
- codestringRequired
- valuesobjectRequired
- basedOnintegerRequired
The version of the list the preview was made against; 0 when none was ever saved.
Status codes
| Status | Meaning |
|---|---|
200 |
What the file would do. |
400 |
The body was refused, or the file is no customers file (invalid_data_file, invalid_json). Nothing was read. |
401 |
No usable credential was sent (invalid_credentials). |
502 |
The engine could not run, so nothing was read (engine_unavailable). |
/v1/data-files/customers/previewscurl -X POST https://api.certinvo.com/v1/data-files/customers/previews \
-H "Authorization: Bearer $CERTINVO_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @body.jsonimport { readFile } from 'node:fs/promises'
const response = await fetch(`https://api.certinvo.com/v1/data-files/customers/previews`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.CERTINVO_API_KEY}`,
'Content-Type': 'application/json',
},
body: await readFile('body.json'),
})
console.log(response.status, await response.json())import os
import requests
response = requests.post(
"https://api.certinvo.com/v1/data-files/customers/previews",
headers={"Authorization": f"Bearer {os.environ['CERTINVO_API_KEY']}", "Content-Type": "application/json"},
data=open("body.json", "rb"),
)
print(response.status_code, response.text){
"counts": {
"new": 0,
"changed": 0,
"same": 0,
"invalid": 0
},
"rows": [
{
"row": 0,
"status": "new",
"id": "string",
"name": "string",
"column": "string",
"message": "string",
"reason": {
"code": "string",
"values": {}
}
}
],
"basedOn": 0
}