تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
استخدِم طريقة ListVehicles للعثور على جميع المركبات التي تستوفي بعض خيارات الطلب المحدّدة. تعرض الطريقة ListVehicles قائمة مقسّمة إلى صفحات بالمركبات
في المشروع التي تتطابق مع طلبات البحث في حقول المركبات.
الفلترة حسب سمات المركبة
يمكنك أيضًا استخدام هذه الطريقة لتطبيق فلتر على سمات المركبة، والتي تعمل كعامل تشغيل AND عند استخدامها مع مواصفات الحقول الأخرى. للحصول على تفاصيل حول بنية طلب البحث الخاص بالفلتر، يُرجى الاطّلاع على الفلترة: AIP-160 للاطّلاع على أمثلة. لمعرفة تفاصيل حول إنشاء سمات المركبة، يُرجى الاطّلاع على حقل سمات المركبة في دليل تعديل حقول المركبة.
مثال على بيانات المركبة
يُجري هذا المثال فلترة في الحقلَين vehicle_type وattributes باستخدام السلسلة filter، ويعرض المركبات من النوع AUTO فقط، ويحصل على القيمة LUXURY للسمة المخصّصة class.
Java
staticfinalStringPROJECT_ID="project-id";VehicleServiceBlockingStubvehicleService=VehicleService.newBlockingStub(channel);Stringparent="providers/"+PROJECT_ID;ListVehiclesRequestlistVehiclesRequest=ListVehiclesRequest.newBuilder().setParent(parent).addTripTypes(TripType.EXCLUSIVE).addVehicleTypes(VehicleType.newBuilder().setCategory(VehicleType.Category.AUTO)).setFilter("attributes.on_trip=\"false\"").setIncludeBackToBack(true)// Fleet Engine includes vehicles that are en route..build();// Error handling// If matches are returned and the authentication passed, the request completed// successfullytry{ListVehiclesResponselistVehiclesResponse=vehicleService.listVehicles(listVehiclesRequest);}catch(StatusRuntimeExceptione){Statuss=e.getStatus();switch(s.getCode()){caseNOT_FOUND:break;casePERMISSION_DENIED:break;}return;}
تاريخ التعديل الأخير: 2025-09-05 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-09-05 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eUse the \u003ccode\u003eListVehicles\u003c/code\u003e method to retrieve vehicles matching specific criteria, such as vehicle type and attributes.\u003c/p\u003e\n"],["\u003cp\u003eFilter vehicles based on attributes, applying an AND operator when combining multiple filters.\u003c/p\u003e\n"],["\u003cp\u003eRefer to AIP-160 for filter query syntax and the Vehicle attributes field guide for attribute creation.\u003c/p\u003e\n"],["\u003cp\u003eThe provided Java and REST examples demonstrate filtering by vehicle type and a custom attribute.\u003c/p\u003e\n"]]],[],null,["# List vehicles\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\nUse the `ListVehicles` method to find all vehicles that satisfy some specific\nrequest options. The `ListVehicles` method returns a paginated list of vehicles\nin the project that matches queries across vehicle fields.\n\nFilter by vehicle attributes\n----------------------------\n\nYou can also use this method to filter on vehicle attributes, which act as AND\noperator when used in conjunction with other field specifications. For details\non filter query syntax, see [Filtering: AIP-160](https://google.aip.dev/160)\nfor examples. For details on creating vehicle attributes, see [Vehicle\nattributes field](/maps/documentation/mobility/fleet-engine/essentials/vehicles/on-demand-vehicle-fields#vehicle_attributes_field) in the **Update vehicle fields** guide.\n\nList vehicle example\n--------------------\n\nThis example filters on both the `vehicle_type` and `attributes` fields using\nthe `filter` string, showing only vehicles of type AUTO and obtaining the LUXURY\nvalue for the custom attribute of `class`. \n\n### Java\n\n static final String PROJECT_ID = \"\u003cvar translate=\"no\"\u003eproject-id\u003c/var\u003e\";\n\n VehicleServiceBlockingStub vehicleService = VehicleService.newBlockingStub(channel);\n\n String parent = \"providers/\" + PROJECT_ID;\n ListVehiclesRequest listVehiclesRequest = ListVehiclesRequest.newBuilder()\n .setParent(parent)\n .addTripTypes(TripType.EXCLUSIVE)\n .addVehicleTypes(VehicleType.newBuilder().setCategory(VehicleType.Category.AUTO))\n .setFilter(\"attributes.on_trip=\\\"false\\\"\")\n .setIncludeBackToBack(true) // Fleet Engine includes vehicles that are en route.\n .build();\n\n // Error handling\n // If matches are returned and the authentication passed, the request completed\n // successfully\n\n try {\n ListVehiclesResponse listVehiclesResponse =\n vehicleService.listVehicles(listVehiclesRequest);\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 curl -X POST \\\n \"https://fleetengine.googleapis.com/v1/providers/\u003cvar translate=\"no\"\u003eproject-id\u003c/var\u003e/vehicles:list\" \\\n -H \"Authorization: Bearer $JWT\" \\\n -H \"Content-Type: application/json\" \\\n --data-binary @- \u003c\u003c EOM\n {\n \"vehicleTypes\": [{\"category\": \"AUTO\"}],\n \"filter\": \"attributes.class=\\\"LUXURY\\\"\",\n }\n EOM\n\nWhat's next\n-----------\n\n- [Search vehicles](/maps/documentation/mobility/fleet-engine/essentials/vehicles/on-demand-search-vehicle)"]]