Skip to main content

mobility — REST API

model-city-mobility covers urban mobility: a citizen's cars (/users/{userId}/cars), SER-zone reservations (regulated parking, /street-reservations and /users/{userId}/street-reservations, paid via Stripe Checkout) and parking sanctions (/sanctions and /users/{userId}/sanctions). The service registers in Eureka as mobility, so the gateway routes /api/mobility/**.

Two authorization patterns coexist:

  • Citizen endpoints (/users/{userId}/...) — no role check; the use case itself requires the token's sub (X-Auth-Sub) to match the path {userId}, returning 403 otherwise. On cars/sanctions it additionally checks resource ownership.
  • Management endpoints (/street-reservations, /sanctions) — require platform admin or mobility agent, verified by ModelCityAccessAspect through CoreClient.

Reservation payment: the client creates the Checkout Session in Stripe and the reservation is persisted with its checkoutSessionId in the initial PENDING state; later, the Stripe webhook (POST /stripe/webhook, a public route) marks it PAID or CANCELLED.

External systems: Stripe (Checkout + signed webhook), PostgreSQL (modelcity-mobility in microservices, modelcity in the monolith) and Valkey (cache). This domain does not call core except to resolve the role on management endpoints. See the mobility data model.

Cars (/users/{userId}/cars)​

OperationEndpointPage
Register carPOST /api/mobility/users/{userId}/carscreate-car
List citizen's carsGET /api/mobility/users/{userId}/carsget-user-cars

SER-zone reservations​

OperationEndpointPage
Create reservationPOST /api/mobility/users/{userId}/street-reservationscreate-street-reservation
List citizen's reservationsGET /api/mobility/users/{userId}/street-reservationsget-user-street-reservations
Renew reservationPOST /api/mobility/users/{userId}/street-reservations/{id}/renewalsrenew-street-reservation
List reservations (management)GET /api/mobility/street-reservationsget-street-reservations
Stripe payment webhookPOST /api/mobility/stripe/webhookstripe-webhook

Sanctions​

OperationEndpointPage
Issue sanctionPOST /api/mobility/sanctionscreate-sanction
List sanctions (management)GET /api/mobility/sanctionsget-sanctions
Sanction detail (management)GET /api/mobility/sanctions/{id}get-sanction
List my sanctionsGET /api/mobility/users/{userId}/sanctionsget-user-sanctions
My sanction detailGET /api/mobility/users/{userId}/sanctions/{id}get-user-sanction

Audit (system trails)​

OperationEndpointPage
Query the audit logGET /api/mobility/system-trailsget-system-trails