Import service items
const url = 'https://example.com/imports/service-items';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 \ --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" } } }'Adds the items on every row that checks clean, with their due dates, in one go, and keeps a record so the import can be undone. Adds the new item types and plans chosen, and adds item types to an existing plan that did not cover them. Refused with 422 while any row has a problem or an item type or plan to choose.
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”Imported
object
UUID v7
Example
{ "id": "019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f", "kind": "customers"}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" } ]}