Check service items before importing them
const url = 'https://example.com/imports/service-items/check';const options = { method: 'POST', headers: { cookie: '__Host-bottle.session_token=<__Host-bottle.session_token>', 'Content-Type': 'application/json' }, body: '{"fileName":"example","rows":[{"accountNumber":"example","customer":"example","postcode":"example","site":"example","type":"example","quantity":"example","serial":"example","product":"example","installedOn":"example","plan":"example","nextDue":"example","lastService":"example","notes":"example","details":{"additionalProperty":"example"}}],"skip":[1],"firstRow":1,"mapping":{"additionalProperty":"example"},"types":{"additionalProperty":{"kind":"existing","id":"019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f"}},"plans":{"additionalProperty":{"kind":"existing","id":"019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f"}}}'};
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://example.com/imports/service-items/check \ --header 'Content-Type: application/json' \ --cookie __Host-bottle.session_token=<__Host-bottle.session_token> \ --data '{ "fileName": "example", "rows": [ { "accountNumber": "example", "customer": "example", "postcode": "example", "site": "example", "type": "example", "quantity": "example", "serial": "example", "product": "example", "installedOn": "example", "plan": "example", "nextDue": "example", "lastService": "example", "notes": "example", "details": { "additionalProperty": "example" } } ], "skip": [ 1 ], "firstRow": 1, "mapping": { "additionalProperty": "example" }, "types": { "additionalProperty": { "kind": "existing", "id": "019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f" } }, "plans": { "additionalProperty": { "kind": "existing", "id": "019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f" } } }'Says what importing each row would do: add its items, skip them as already in Bottle, or a problem with the fix. Lists every item type and plan the file names, with the one each matched by name. Nothing is saved.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
object
object
object
object
object
UUID v7
Example
019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8fobject
Last_service: the next date counts from the day the service was done. anniversary: the dates stay fixed from the first one.
Day: due on the date. month: due within the month; the date held is the 1st of the month.
object
Responses
Section titled “Responses”What each row would do
object
object
object
object
object
UUID v7
object
UUID v7
Example
{ "rows": [ { "action": "create" } ], "types": [ { "typeId": "019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f" } ], "plans": [ { "planId": "019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f" } ]}Not signed in
object
Example
{ "error": "not_found", "message": "Customer not found"}Not an owner or admin, or the plan does not open Equipment servicing
object
Example
{ "error": "not_found", "message": "Customer not found"}Not found, or Equipment servicing is not available to this business
object
Example
{ "error": "not_found", "message": "Customer not found"}Equipment servicing is switched off, or the import was already undone
object
Example
{ "error": "not_found", "message": "Customer not found"}Validation failed, rows still have problems, or an item type or plan still needs choosing
object
object
Example
{ "error": "validation", "issues": [ { "path": "email", "message": "Invalid email" } ]}