Add a service plan
const url = 'https://example.com/service-plans';const options = { method: 'POST', headers: { cookie: '__Host-bottle.session_token=<__Host-bottle.session_token>', 'Content-Type': 'application/json' }, body: '{"name":"example","intervalMonths":1,"nextFrom":"last_service","dueRule":"day","startFrom":"installed","startField":"example","itemTypeIds":["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/service-plans \ --header 'Content-Type: application/json' \ --cookie __Host-bottle.session_token=<__Host-bottle.session_token> \ --data '{ "name": "example", "intervalMonths": 1, "nextFrom": "last_service", "dueRule": "day", "startFrom": "installed", "startField": "example", "itemTypeIds": [ "019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f" ] }'StartField is required when startFrom is field, and names the date detail the first service counts from. Every item type the plan applies to must have a date detail of that name.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
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.
What the first due date counts from. installed: the item’s installed date. field: the item’s date detail named in startField. entered: a date typed in when the plan is given to the item.
Responses
Section titled “Responses”Added
object
UUID v7
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.
What the first due date counts from. installed: the item’s installed date. field: the item’s date detail named in startField. entered: a date typed in when the plan is given to the item.
Example
{ "id": "019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f", "name": "Annual inspection", "intervalMonths": 12, "nextFrom": "last_service", "dueRule": "day", "startFrom": "installed", "itemTypeIds": [ "019205d1-6e7a-7c3b-9f6e-3a2b1c0d9e8f" ]}Not signed in
object
Example
{ "error": "not_found", "message": "Customer not found"}Not an owner or admin, missing scope, 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, other equipment already has that detail, or the cylinder already has servicing set up
object
Example
{ "error": "not_found", "message": "Customer not found"}Validation failed
object
object
Example
{ "error": "validation", "issues": [ { "path": "email", "message": "Invalid email" } ]}