People are the staff and drivers your business works with. You will be able to find a person, add one, change their details and make them inactive without losing track of an open shift, an open call or an open advance.
Before you start #
- You are an owner, a manager or a dispatcher (the fleet-manager group).
- Fleet writes need the
dispatch_fleetlicense flag. Reads work without it.
Steps #
- List people with
GET /people. Narrow the list withq(part of a name),driver=1(drivers only),active=1oractive=0, and page through withlimitandcursor. - Add a person with
POST /people. Sendname, and optionallyphone,email,employee_noandnotes. For a driver add adriverblock withpay_mode(none,hourly,per_callorpercent),pay_value,current_asset_id(the usual vehicle) andactive. - Read one person with
GET /people/<id>. - Change a person with
PATCH /people/<id>. Send any field from step 2.current_asset_id: nullclears the usual vehicle. Settingdriver.on_shift: trueneeds a usual vehicle. - Before making someone inactive, call
GET /people/<id>/leaving-check. The answer says whether the person isready, lists what blocks the change (on_shiftoropen_call) and shows any open advance by currency. - Make the person inactive with
PATCH /people/<id>andactive: false. - Confirm the result. The person and the driver profile show inactive, and the person's sign-in ends.
How the leaving check decides #
- A shift in progress or an open call stops the change with
leaving_check(409). End the shift or finish or reassign the call, then try again. Confirming cannot override this. - An open advance balance stops the change until you send
confirm_leaving: true. The balance carries over and the audit log records that you confirmed it. Settling the advance first is the cleaner path. See "Driver profiles". - Nobody can make their own account inactive. That answers
conflict(409).
Technical details
pay_valueis hundredths of a percent forpercent(up to 10000) and minor units of money for the other modes.- The person answer holds
id,name,phone,email,employee_no,notes,active,created_at,roles,user_idanddriver(null, orpay_mode,pay_value,active,on_shift,current_asset_id,shift_started_at). - The leaving check answer holds
person_id,ready,blocking(each withcodeandmessage),open_advances,open_call,on_shiftandmessages.
If something goes wrong #
leaving_check(409): readblocking, deal with each item, then send the change again.conflict(409): you tried to make your own account inactive, or the driver needs a usual vehicle before going on shift.not_found(404): no such person.feature_not_licensed(403) orlicence_read_only(403): ask the owner to restore the license.