Method: providers.vehicles.create
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
实例化与按需拼车或配送服务提供商关联的新车。每个 Vehicle
都必须具有唯一的车辆 ID。
创建 Vehicle
时,以下 Vehicle
字段为必填字段:
vehicleState
supportedTripTypes
maximumCapacity
vehicleType
创建 Vehicle
时,系统会忽略以下 Vehicle
字段:
name
currentTrips
availableCapacity
currentRouteSegment
currentRouteSegmentEndPoint
currentRouteSegmentVersion
currentRouteSegmentTraffic
route
waypoints
waypointsVersion
remainingDistanceMeters
remainingTimeSeconds
eta_to_next_waypoint
navigationStatus
其他所有字段均为选填字段,如果提供,则会使用这些字段。
HTTP 请求
POST https://fleetengine.googleapis.com/v1/{parent=providers/*}/vehicles
网址采用 gRPC 转码语法。
路径参数
参数 |
parent |
string
必需。必须采用 providers/{provider} 格式。提供方必须是 Google Cloud 项目的 ID(例如 sample-cloud-project ),进行此调用的服务账号所属的 Google Cloud 项目所属的项目。
|
查询参数
参数 |
header |
object (RequestHeader )
标准 Fleet Engine 请求标头。
|
vehicleId |
string
必需。唯一车辆 ID。需遵循以下限制:
- 必须是有效的 Unicode 字符串。
- 长度上限为 64 个字符。
- 根据 Unicode 标准化形式 C 进行标准化。
- 不得包含以下任何 ASCII 字符:“/”“:”“?”“,”或“#”。
|
请求正文
请求正文包含一个 Vehicle
实例。
响应正文
如果成功,响应正文将包含一个新创建的 Vehicle
实例。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-31。
[null,null,["最后更新时间 (UTC):2025-08-31。"],[[["\u003cp\u003eInstantiates a new vehicle associated with an on-demand rideshare or deliveries provider, requiring a unique vehicle ID for each vehicle.\u003c/p\u003e\n"],["\u003cp\u003eWhen creating a \u003ccode\u003eVehicle\u003c/code\u003e, \u003ccode\u003evehicleState\u003c/code\u003e, \u003ccode\u003esupportedTripTypes\u003c/code\u003e, \u003ccode\u003emaximumCapacity\u003c/code\u003e, and \u003ccode\u003evehicleType\u003c/code\u003e fields are required; while fields like \u003ccode\u003ename\u003c/code\u003e, \u003ccode\u003ecurrentTrips\u003c/code\u003e, \u003ccode\u003eavailableCapacity\u003c/code\u003e, and route-related fields are ignored.\u003c/p\u003e\n"],["\u003cp\u003eSends a POST request to \u003ccode\u003ehttps://fleetengine.googleapis.com/v1/{parent=providers/*}/vehicles\u003c/code\u003e to create a vehicle, with the provider specified in the path parameter.\u003c/p\u003e\n"],["\u003cp\u003eRequires a \u003ccode\u003eheader\u003c/code\u003e for the Fleet Engine request and a unique \u003ccode\u003evehicleId\u003c/code\u003e in the query parameters, adhering to specified restrictions for the \u003ccode\u003evehicleId\u003c/code\u003e format.\u003c/p\u003e\n"],["\u003cp\u003eIncludes the \u003ccode\u003eVehicle\u003c/code\u003e object details in the request body and returns the newly created \u003ccode\u003eVehicle\u003c/code\u003e object in the response body upon successful creation.\u003c/p\u003e\n"]]],[],null,["# Method: providers.vehicles.create\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n\nInstantiates a new vehicle associated with an on-demand rideshare or deliveries provider. Each `Vehicle` must have a unique vehicle ID.\n\nThe following `Vehicle` fields are required when creating a `Vehicle`:\n\n- `vehicleState`\n- `supportedTripTypes`\n- `maximumCapacity`\n- `vehicleType`\n\nThe following `Vehicle` fields are ignored when creating a `Vehicle`:\n\n- `name`\n- `currentTrips`\n- `availableCapacity`\n- `currentRouteSegment`\n- `currentRouteSegmentEndPoint`\n- `currentRouteSegmentVersion`\n- `currentRouteSegmentTraffic`\n- `route`\n- `waypoints`\n- `waypointsVersion`\n- `remainingDistanceMeters`\n- `remainingTimeSeconds`\n- `eta_to_next_waypoint`\n- `navigationStatus`\n\nAll other fields are optional and used if provided.\n\n### HTTP request\n\n`POST https://fleetengine.googleapis.com/v1/{parent=providers/*}/vehicles`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `parent` | `string` Required. Must be in the format `providers/{provider}`. The provider must be the Project ID (for example, `sample-cloud-project`) of the Google Cloud Project of which the service account making this call is a member. |\n\n### Query parameters\n\n| Parameters ||\n|-------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `header` | `object (`[RequestHeader](/maps/documentation/mobility/fleet-engine/reference/trips/rest/v1/RequestHeader)`)` The standard Fleet Engine request header. |\n| `vehicleId` | `string` Required. Unique Vehicle ID. Subject to the following restrictions: - Must be a valid Unicode string. - Limited to a maximum length of 64 characters. - Normalized according to [Unicode Normalization Form C](http://www.unicode.org/reports/tr15/). - May not contain any of the following ASCII characters: '/', ':', '?', ',', or '#'. |\n\n### Request body\n\nThe request body contains an instance of [Vehicle](/maps/documentation/mobility/fleet-engine/reference/trips/rest/v1/providers.vehicles#Vehicle).\n\n### Response body\n\nIf successful, the response body contains a newly created instance of [Vehicle](/maps/documentation/mobility/fleet-engine/reference/trips/rest/v1/providers.vehicles#Vehicle)."]]