با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
این سند نحوه دریافت وسیله نقلیه را از محیط سرور با استفاده از gRPC یا REST توضیح می دهد.
یک نمونه وسیله نقلیه تحویل بگیرید
می توانید از کتابخانه gRPC جاوا برای تهیه وسیله نقلیه استفاده کنید یا از REST استفاده کنید.
جاوا
staticfinalStringPROJECT_ID="my-delivery-co-gcp-project";staticfinalStringVEHICLE_ID="vehicle-8241890";DeliveryServiceBlockingStubdeliveryService=DeliveryServiceGrpc.newBlockingStub(channel);// Vehicle requestStringname="providers/"+PROJECT_ID+"/deliveryVehicles/"+VEHICLE_ID;GetDeliveryVehicleRequestgetVehicleRequest=GetDeliveryVehicleRequest.newBuilder()// No need for the header.setName(name).build();try{DeliveryVehiclevehicle=deliveryService.getDeliveryVehicle(getVehicleRequest);}catch(StatusRuntimeExceptione){Statuss=e.getStatus();switch(s.getCode()){caseNOT_FOUND:break;casePERMISSION_DENIED:break;}return;}
استراحت
GEThttps://fleetengine.googleapis.com/v1/providers/<project_id>/deliveryVehicles/<vehicleId>
# Set JWT, PROJECT_ID, and VEHICLE_ID in the local environmentcurl-H"Authorization: Bearer ${JWT}"\
"https://fleetengine.googleapis.com/v1/providers/${PROJECT_ID}/deliveryVehicles/${VEHICLE_ID}"
تاریخ آخرین بهروزرسانی 2025-08-29 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-08-29 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003eThis document explains how to retrieve vehicle data from a server using gRPC or REST methods.\u003c/p\u003e\n"],["\u003cp\u003eBefore making vehicle requests, review the requirements outlined in the Vehicle requests section of the Introduction.\u003c/p\u003e\n"],["\u003cp\u003eThe provided examples demonstrate getting a delivery vehicle using Java with gRPC and using REST with curl commands.\u003c/p\u003e\n"],["\u003cp\u003eThe 'What's next' section directs users to learn about listing vehicles using scheduled tasks.\u003c/p\u003e\n"]]],[],null,["# Get a delivery vehicle\n\n| **Note:** **Before constructing a vehicle request** , read the requirements under [Vehicle requests](/maps/documentation/mobility/fleet-engine/essentials/vehicles#vehicle_requests) in the Introduction.\n\nThis document describes how to get a vehicle from a server environment using\neither gRPC or REST.\n\nGet a delivery vehicle example\n------------------------------\n\nYou can use the [Java gRPC library](/maps/documentation/mobility/fleet-engine/essentials/client-libraries-tasks#java) to get a vehicle, or use REST. \n\n### Java\n\n static final String PROJECT_ID = \"my-delivery-co-gcp-project\";\n static final String VEHICLE_ID = \"vehicle-8241890\";\n\n DeliveryServiceBlockingStub deliveryService =\n DeliveryServiceGrpc.newBlockingStub(channel);\n\n // Vehicle request\n String name = \"providers/\" + PROJECT_ID + \"/deliveryVehicles/\" + VEHICLE_ID;\n GetDeliveryVehicleRequest getVehicleRequest = GetDeliveryVehicleRequest.newBuilder() // No need for the header\n .setName(name)\n .build();\n\n try {\n DeliveryVehicle vehicle = deliveryService.getDeliveryVehicle(getVehicleRequest);\n } catch (StatusRuntimeException e) {\n Status s = e.getStatus();\n switch (s.getCode()) {\n case NOT_FOUND:\n break;\n case PERMISSION_DENIED:\n break;\n }\n return;\n }\n\n### REST\n\n GET https://fleetengine.googleapis.com/v1/providers/\u003cproject_id\u003e/deliveryVehicles/\u003cvehicleId\u003e\n\n # Set JWT, PROJECT_ID, and VEHICLE_ID in the local environment\n curl -H \"Authorization: Bearer ${JWT}\" \\\n \"https://fleetengine.googleapis.com/v1/providers/${PROJECT_ID}/deliveryVehicles/${VEHICLE_ID}\"\n\nWhat's next\n-----------\n\n- [List vehicles](/maps/documentation/mobility/fleet-engine/essentials/vehicles/scheduled-tasks-list-vehicle)"]]