Skip to content

Add the driver inspection requests - #60

Merged
roncodes merged 6 commits into
mainfrom
feat/driver-inspections
Sep 11, 2026
Merged

Add the driver inspection requests#60
roncodes merged 6 commits into
mainfrom
feat/driver-inspections

Conversation

@roncodes

@roncodes roncodes commented Sep 9, 2026

Copy link
Copy Markdown
Member

Summary

Documents the driver-facing inspections API that fleetbase/fleetops#319 (feature/inspections-driver-api, draft) adds under v1, which the Navigator app and other integrations use.

Folder Inspections (order 7750, after Vehicles and Drivers so {{vehicle_id}} and {{driver_id}} exist when it runs). Every request authenticates with the API key.

Request Method URL
List Inspection Forms GET /v1/inspection-forms?vehicle=
Retrieve an Inspection Form GET /v1/inspection-forms/:id
Submit an Inspection POST /v1/inspections (with Idempotency-Key: {{$guid}})
List Inspections GET /v1/inspections?driver=
Retrieve an Inspection GET /v1/inspections/:id
List Vehicle Inspections GET /v1/vehicles/:id/inspections

Only the consumable API is documented. fleetops#319 also adds public inspection-link routes under /public/inspections/forms. They take no session, but their only consumer is the console's public inspection page, so by use they are internal and are deliberately left out of this collection. An integration files an inspection through Submit an Inspection.

Related Issue

Companion to fleetbase/fleetops#319 (draft, supersedes fleetbase/fleetops#267). The CI seed the requests need, a published form with typed field groups, is fleetbase/fleetbase#652.

Type of Change

  • Feature
  • Documentation

Implementation Notes

  • A form is groups of typed fields. Since fleetops#319's second cut, a form answers grouped_fields, and an inspection arrives as custom_field_values, one per field, with photos and signatures stored as files and resolved on the way back. Retrieve an Inspection Form documents the field types and chains a pass-fail, a meter and a signature field; Submit an Inspection builds custom_field_values from them and also sends the flat item_results, as the driver app does, so one request answers 2xx against either cut.
  • Variables: inspection_form_id and inspection_id, declared with empty defaults in the collection definition for documentation; the CLI only substitutes --env-var values. The published form they start from comes from fleetbase#652's seed.
  • No pm.execution.skipRequest() guards, no request writes driver_identity, driver_password or driver_phone, and there is no DELETE in the folder.

Validation

  • Lint
  • Manual validation against a live stack

scripts/validate-collections.js passes (5 collections, 3 environments). postman collection lint with Postman CLI 1.46.0 reports 0 errors and 0 warnings. Every changed YAML file parses, and the embedded scripts pass node --check.

Not run against a live stack: no local stack carries the fleetops branch with the seed.

Documentation Impact

  • No documentation changes needed
  • Documentation updated in fleetbase/fleetbase.io
  • Documentation needed but not included

API Reference Impact

  • Updated fleetbase/postman

API reference notes: six new v1 endpoints under the Fleetbase API collection; fleetbase/fleetbase.io regeneration needed once merged.

Documentation Notes

A driver-app guide for inspections (fleet-ops/maintenance/inspections/overview, which the maintenance hub already links to) would belong in fleetbase/fleetbase.io.

Risk

Merge order matters. fleetbase/fleetops#319's contract workflow runs the collection at postman-ref: main, and the published fleetbase-api:latest image does not carry the inspections API yet.

  1. Merging this first makes the six requests run against every module's contract job, failing until the fleetops branch is released and fleetbase#652's seed is in place.
  2. Merging fleetops#319 first leaves its own contract job unable to exercise these requests until this lands.

Suggested: land fleetops#319 and fleetbase#652, then this; or verify together by pointing the fleetops workflow at postman-ref: feat/driver-inspections for one run. Nothing else in the collection changes.

Screenshots / Recordings

n/a

fleetbase/fleetops adds a driver-facing inspections API under v1 — the
published forms, filing a DVIR against one, and reading back what was filed.
An Inspections folder documents the six requests, and List Vehicle
Inspections sits with them rather than under Vehicles because it needs an
inspection to have been filed first.

Ordered at 7750, after Vehicles and Drivers, so {{vehicle_id}} and
{{driver_id}} exist when it runs.

Forms are published from the console, not this API, so List Inspection
Forms chains {{inspection_form_id}} from the first published form and the
three requests that address a form or file against one need the contract
run to seed a published form for the CI organisation. Without that seed
those three answer 404 and 422; the listings answer 200 regardless.
fleetops#319 changed what an inspection form is. A form is no longer a flat
list of pass/fail items, it is groups of typed fields, and it answers
`grouped_fields`. An inspection is that form filled in: the driver's answers
arrive as `custom_field_values` and come back the same way, with every photo
and signature stored as a file and resolved to something fetchable, beside
the `item_results` the server derives from the pass/fail answers.

Retrieve an Inspection Form documents the field types and what a `pass-fail`
field's `meta` says happens on failure, and chains a pass-fail, a meter and
a signature field from the form it read. Submit an Inspection builds its
`custom_field_values` from those, and asserts the files came back resolved.

A field is named by an id that only exists once the form has been read, and
a form that has not been rebuilt from the first cut has no fields to name.
So the submit sends both bodies, as the driver app does: `custom_field_values`
when the ids resolved, and the flat `item_results` either way. The server
prefers the field values and ignores the duplicated results, which means one
request is 2xx against either cut — no request is skipped.
Three requests for the tokenised public inspection link, in the
Inspections folder after the driver requests:

- Retrieve a Public Inspection Form (GET) asserts the form and the
  identity come back, that the driver no longer carries a phone number,
  and chains the form's grouped_fields for the next two requests.
- Upload a Public Inspection Photo (POST, multipart) sends the sample
  PNG Files/Upload File already uses, with the token as a form field,
  and chains the returned file_ id.
- Submit a Public Inspection (POST) builds custom_field_values in its
  pre-request script from the chained form, answering every field with
  a passing value, and file-upload and signature fields with the
  uploaded file as file:<id>.

All three take {{inspection_link_form_id}} and {{inspection_link_token}},
declared empty on the collection; a contract run seeds a link and passes
both in. The routes are public and ignore Authorization, so the
collection's bearer is left inherited: nothing in this repository shows
a verified request-level way to clear auth in the v3 format.
Links now carry a six-digit PIN, shared separately from the link. The three
public requests send it as X-Inspection-Pin from inspection_link_pin, and
describe the 403s a missing, wrong or locked PIN answers. The retrieve test
also checks the identity names who the link is for.
fleetops#319 now emails or texts the link and its PIN together, so the
retrieve description no longer says the PIN is shared separately.
The public inspection-link routes in fleetops#319 have no session, but their
only consumer is the console's public inspection page, so they are internal
by use and do not belong in a collection documenting the consumable API.
Integrations file inspections through Submit an Inspection (POST
/v1/inspections). This removes the three requests, their collection
variables, and the folder description's paragraph about them.
@roncodes
roncodes marked this pull request as ready for review September 11, 2026 10:56
@roncodes
roncodes merged commit 08ad437 into main Sep 11, 2026
1 check passed
@roncodes
roncodes deleted the feat/driver-inspections branch September 11, 2026 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant