Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
In diesem Leitfaden erfahren Sie, wie Sie überprüfen können, ob Ihre Fleet Engine-Autorisierung vollständig eingerichtet ist und ob Sie ein Testfahrzeug erstellen können. In dieser Anleitung wird das Befehlszeilentool gcloud verwendet, um die Signierung von Autorisierungstokens und die Erstellung von Fahrzeugen zu testen.
So schließen Sie diesen Vorgang ab:
Ersetzen Sie die Felder unten durch die Daten, die Sie im Rahmen der Einrichtung erstellt haben:
Feld
Ersetzen durch
PROJECT_ID
Ihre Cloud-Projekt-ID.
SERVICE_ACCOUNT_EMAIL_ADDRESS
Die E-Mail-Adresse eines Dienstkontos, das Sie mit der Rolle „Administrator“ erstellt haben. Weitere Informationen finden Sie unter Rollen für Mobility-Dienstkonten.
VEHICLE_ID
OR
DELIVERY_VEHICLE_ID
Eine zufällige ID für das Fahrzeug. Die ID darf maximal 64 Zeichen lang sein.
Melden Sie sich mit dem gcloud-Tool im Google Cloud-Konto an und legen Sie das aktive Projekt auf Ihrer Workstation fest:
gcloudauthlogin
gcloudconfigsetprojectPROJECT_ID
Erstellen Sie einen JSON Web Token-Anspruch (JWT) für die Fahrzeugherstellung:
[null,null,["Zuletzt aktualisiert: 2025-08-31 (UTC)."],[[["\u003cp\u003eThis guide provides instructions to verify your Fleet Engine authorization and create a trial vehicle using the \u003ccode\u003egcloud\u003c/code\u003e command line utility.\u003c/p\u003e\n"],["\u003cp\u003eYou will need your Cloud project ID, service account email address, and a unique vehicle ID to complete the verification process.\u003c/p\u003e\n"],["\u003cp\u003eThe process involves generating and signing a JWT, then using it to create a test vehicle via a \u003ccode\u003ecurl\u003c/code\u003e command.\u003c/p\u003e\n"],["\u003cp\u003eSuccessful setup is indicated by the output displaying the name of the created vehicle (e.g., "providers/PROJECT_ID/vehicles/VEHICLE_ID").\u003c/p\u003e\n"],["\u003cp\u003eFleet Engine automatically purges inactive vehicles after 7 days, eliminating the need for manual deletion.\u003c/p\u003e\n"]]],[],null,["# Verify your setup\n\nThis guide helps you verify that your Fleet Engine authorization setup is\ncomplete, and that you can create a trial vehicle. This guide uses\n[the `gcloud` command line utility](https://cloud.google.com/sdk/gcloud) to test\nauthorization token signing and vehicle creation.\n\nTo complete this process, do the following:\n\n1. Replace the fields below with the data you created as part of the setup:\n\n| Field | Replace with |\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| \u003cvar class=\"edit\" scope=\"PROJECT_ID\" translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e | Your Cloud project ID. |\n| \u003cvar class=\"edit\" scope=\"SERVICE_ACCOUNT_EMAIL_ADDRESS\" translate=\"no\"\u003eSERVICE_ACCOUNT_EMAIL_ADDRESS\u003c/var\u003e | The email address of a service account you've created with the Admin role. See [Mobility service account roles](/maps/documentation/mobility/fleet-engine/essentials/set-up-fleet/service-accounts#mobility_service_account_roles) for details. |\n| \u003cvar class=\"edit\" scope=\"VEHICLE_ID\" translate=\"no\"\u003eVEHICLE_ID\u003c/var\u003e **OR** \u003cvar class=\"edit\" scope=\"DELIVERY_VEHICLE_ID\" translate=\"no\"\u003eDELIVERY_VEHICLE_ID\u003c/var\u003e | A random ID for the vehicle. The ID can contain a maximum of 64 characters. |\n\n1. Use the `gcloud` utility to log into the Google Cloud account and set the\n active project on your workstation:\n\n gcloud auth login\n gcloud config set project \u003cvar label=\"project ID\" translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e\n\n2. Create a JSON Web Token (JWT) claim for the vehicle creation:\n\n ### On-demand trips\n\n ```\n cat \u003e claim.jwt \u003c\u003c EOM\n {\n \"iss\": \"SERVICE_ACCOUNT_EMAIL_ADDRESS\",\n \"sub\": \"SERVICE_ACCOUNT_EMAIL_ADDRESS\",\n \"aud\": \"https://fleetengine.googleapis.com/\",\n \"iat\": $(date +%s),\n \"exp\": $((`date +%s` + 3600)),\n \"authorization\": {\n \"vehicleid\": \"VEHICLE_ID\"\n }\n }\n EOM\n \n ```\n\n ### Scheduled tasks\n\n ```\n cat \u003e claim.jwt \u003c\u003c EOM\n {\n \"iss\": \"SERVICE_ACCOUNT_EMAIL_ADDRESS\",\n \"sub\": \"SERVICE_ACCOUNT_EMAIL_ADDRESS\",\n \"aud\": \"https://fleetengine.googleapis.com/\",\n \"iat\": $(date +%s),\n \"exp\": $((`date +%s` + 3600)),\n \"authorization\": {\n \"deliveryvehicleid\": \"DELIVERY_VEHICLE_ID\"\n }\n }\n EOM\n \n ```\n3. Use `gcloud` to sign this JWT with the appropriate IAM permissions. :\n\n gcloud iam service-accounts sign-jwt claim.jwt output.jwt \\\n --iam-account=\u003cvar translate=\"no\"\u003eSERVICE_ACCOUNT_EMAIL_ADDRESS\u003c/var\u003e\n\n The signed JWT is stored in `output.jwt`.\n\n For details, see [Provide required permissions](https://cloud.google.com/iam/docs/create-short-lived-credentials-direct#permissions-access) and\n [the `gcloud` command line guide](https://cloud.google.com/sdk/gcloud/reference/beta/iam/service-accounts/sign-jwt) in the Google Cloud\n documentation.\n4. Use `curl` to create a test vehicle on Fleet Engine:\n\n ### On-demand trips\n\n ```\n curl -X POST \"https://fleetengine.googleapis.com/v1/providers/PROJECT_ID/vehicles?vehicleId=VEHICLE_ID\" \\\n -H \"Content-type: application/json\" \\\n -H \"Authorization: Bearer $(cat output.jwt)\" \\\n --data-binary @- \u003c\u003c EOM\n {\n \"name\": \"providers/PROJECT_ID/vehicles/VEHICLE_ID\"\n }\n EOM\n {\n \"vehicleState\": \"OFFLINE\",\n \"supportedTripTypes\": [\"EXCLUSIVE\"],\n \"maximumCapacity\": 4,\n \"vehicleType\": {\"category\": \"AUTO\"},\n \"attributes\": [{\"key\": \"on_trip\", \"value\": \"false\"}]\n }\n \n ```\n\n This command should print the name of the vehicle as output. If you\n see the following text, your setup is successful. \n\n ```\n {\n \"name\": \"providers/PROJECT_ID/vehicles/VEHICLE_ID\"\n }\n \n ```\n\n ### Scheduled tasks\n\n ```\n curl -X POST \"https://fleetengine.googleapis.com/v1/providers/PROJECT_ID/deliveryVehicles?deliveryVehicleId=DELIVERY_VEHICLE_ID\" \\\n -H \"Content-type: application/json\" \\\n -H \"Authorization: Bearer $(cat output.jwt)\" \\\n --data-binary @- \u003c\u003c EOM\n {\n \"name\": \"providers/PROJECT_ID/deliveryVehicles/DELIVERY_VEHICLE_ID\"\n }\n EOM\n \n ```\n\n This command should print the name of the delivery vehicle as output. If you\n see the following text, your setup is successful. \n\n ```\n {\n \"name\": \"providers/PROJECT_ID/deliveryVehicles/DELIVERY_VEHICLE_ID\"\n }\n \n ```\n | **Note:** Fleet Engine automatically purges all entities (including vehicles) after 7 days of inactivity, such as updates.\n\nWhat's next\n-----------\n\n- [Troubleshoot common issues](/maps/documentation/mobility/fleet-engine/essentials/set-up-fleet/troubleshoot)\n- [Create and use vehicles](/maps/documentation/mobility/fleet-engine/essentials/vehicles)"]]