Method: providers.tasks.batchCreate
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
สร้างและแสดงผลออบเจ็กต์ Task
ใหม่หลายรายการ
คำขอ HTTP
POST https://fleetengine.googleapis.com/v1/{parent=providers/*}/tasks:batchCreate
URL ใช้ไวยากรณ์การแปลง gRPC
พารามิเตอร์เส้นทาง
พารามิเตอร์ |
parent |
string
ต้องระบุ ทรัพยากรหลักที่งานทั้งหมดแชร์ ค่านี้ต้องอยู่ในรูปแบบ providers/{provider} provider ต้องเป็นรหัสโปรเจ็กต์ Google Cloud เช่น sample-cloud-project ช่องหลักในข้อความ CreateTaskRequest ต้องว่างเปล่าหรือต้องตรงกับช่องนี้
|
เนื้อหาของคำขอ
เนื้อความของคำขอมีข้อมูลซึ่งมีโครงสร้างดังต่อไปนี้
ช่อง |
header |
object (DeliveryRequestHeader )
ไม่บังคับ ส่วนหัวคำขอ Delivery API มาตรฐาน หมายเหตุ: หากคุณตั้งค่าช่องนี้ ช่องส่วนหัวในข้อความ CreateTaskRequest ต้องว่างเปล่าหรือต้องตรงกับช่องนี้
|
requests[] |
object (CreateTaskRequest )
ต้องระบุ ข้อความคําขอที่ระบุทรัพยากรที่จะสร้าง หมายเหตุ: คุณสร้างงานได้สูงสุด 500 งานในชุด
|
เนื้อหาการตอบกลับ
ข้อความตอบกลับ BatchCreateTask
หากทำสำเร็จ เนื้อหาการตอบกลับจะมีข้อมูลซึ่งมีโครงสร้างดังต่อไปนี้
การแสดง JSON |
{
"tasks": [
{
object (Task )
}
]
} |
ช่อง |
tasks[] |
object (Task )
งานที่สร้างขึ้น
|
CreateTaskRequest
ข้อความคําขอ tasks.create
ช่อง |
parent |
string
ต้องระบุ ต้องอยู่ในรูปแบบ providers/{provider} provider ต้องเป็นรหัสโปรเจ็กต์ Google Cloud เช่น sample-cloud-project
|
taskId |
string
ต้องระบุ รหัสงานต้องไม่ซ้ำกัน แต่ไม่ควรเป็นรหัสติดตามการจัดส่ง หากต้องการจัดเก็บรหัสติดตามการจัดส่ง ให้ใช้ช่อง trackingId โปรดทราบว่างานหลายรายการอาจมี trackingId เดียวกัน รหัสงานมีข้อจํากัดต่อไปนี้
- ต้องเป็นสตริง Unicode ที่ถูกต้อง
- จำกัดความยาวสูงสุดไว้ที่ 64 อักขระ
- แปลงตามรูปแบบการแปลง Unicode C
- ต้องไม่มีอักขระ ASCII ต่อไปนี้ /, :, ?, , หรือ #
|
task |
object (Task )
ต้องระบุ เอนทิตีงานที่จะสร้าง เมื่อสร้างงาน คุณต้องกรอกข้อมูลในช่องต่อไปนี้
type
state (ต้องตั้งค่าเป็น OPEN )
trackingId (ต้องไม่ตั้งค่าสำหรับงาน UNAVAILABLE หรือ SCHEDULED_STOP แต่ต้องตั้งค่าสำหรับงานประเภทอื่นๆ ทั้งหมด)
plannedLocation (ไม่บังคับสำหรับงาน UNAVAILABLE รายการ)
taskDuration
คุณตั้งค่าฟิลด์ต่อไปนี้ได้
targetTimeWindow
taskTrackingViewConfig
attributes
หมายเหตุ: ระบบจะไม่สนใจช่อง name ของงาน ต้องไม่ตั้งค่าช่องงานอื่นๆ ทั้งหมด มิเช่นนั้นระบบจะแสดงข้อผิดพลาด
|
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-31 UTC
[null,null,["อัปเดตล่าสุด 2025-08-31 UTC"],[[["\u003cp\u003eCreates up to 500 \u003ccode\u003eTask\u003c/code\u003e objects at once using the \u003ccode\u003eBatchCreateTasks\u003c/code\u003e method.\u003c/p\u003e\n"],["\u003cp\u003eRequires a \u003ccode\u003eparent\u003c/code\u003e resource in the URL path, indicating the Google Cloud Project ID.\u003c/p\u003e\n"],["\u003cp\u003eThe request body includes an optional \u003ccode\u003eheader\u003c/code\u003e and a required list of \u003ccode\u003erequests\u003c/code\u003e, each defining a \u003ccode\u003eTask\u003c/code\u003e to create.\u003c/p\u003e\n"],["\u003cp\u003eThe response returns a list of created \u003ccode\u003eTask\u003c/code\u003e objects within the \u003ccode\u003etasks\u003c/code\u003e field.\u003c/p\u003e\n"],["\u003cp\u003eEach individual \u003ccode\u003eCreateTaskRequest\u003c/code\u003e requires a \u003ccode\u003etaskId\u003c/code\u003e, \u003ccode\u003etype\u003c/code\u003e, \u003ccode\u003estate\u003c/code\u003e, \u003ccode\u003etrackingId\u003c/code\u003e, and other relevant fields depending on the task type.\u003c/p\u003e\n"]]],["This document details how to create a batch of `Task` objects via a `POST` HTTP request to `https://fleetengine.googleapis.com/v1/{parent=providers/*}/tasks:batchCreate`. The `parent` path parameter is required and specifies the provider. The request body should contain a `header` and an array of `requests`, where each request includes a `CreateTaskRequest`. Each `CreateTaskRequest` requires a `parent`, `taskId`, and a `task` entity with specific fields. The response body returns an array of the created `Task` objects.\n"],null,["# Method: providers.tasks.batchCreate\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Request body](#body.request_body)\n - [JSON representation](#body.request_body.SCHEMA_REPRESENTATION)\n- [Response body](#body.response_body)\n - [JSON representation](#body.BatchCreateTasksResponse.SCHEMA_REPRESENTATION)\n- [CreateTaskRequest](#CreateTaskRequest)\n - [JSON representation](#CreateTaskRequest.SCHEMA_REPRESENTATION)\n\nCreates and returns a batch of new `Task` objects.\n\n### HTTP request\n\n`POST https://fleetengine.googleapis.com/v1/{parent=providers/*}/tasks:batchCreate`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `parent` | `string` Required. The parent resource shared by all tasks. This value must be in the format `providers/{provider}`. The `provider` must be the Google Cloud Project ID. For example, `sample-cloud-project`. The parent field in the `CreateTaskRequest` messages must either be empty, or it must match this field. |\n\n### Request body\n\nThe request body contains data with the following structure:\n\n| JSON representation |\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"header\": { object (/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/DeliveryRequestHeader) }, \"requests\": [ { object (/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/providers.tasks/batchCreate#CreateTaskRequest) } ] } ``` |\n\n| Fields ||\n|--------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `header` | `object (`[DeliveryRequestHeader](/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/DeliveryRequestHeader)`)` Optional. The standard Delivery API request header. Note: If you set this field, then the header field in the `CreateTaskRequest` messages must either be empty, or it must match this field. |\n| `requests[]` | `object (`[CreateTaskRequest](/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/providers.tasks/batchCreate#CreateTaskRequest)`)` Required. The request message that specifies the resources to create. Note: You can create a maximum of 500 tasks in a batch. |\n\n### Response body\n\nThe `BatchCreateTask` response message.\n\nIf successful, the response body contains data with the following structure:\n\n| JSON representation |\n|------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"tasks\": [ { object (/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/providers.tasks#Task) } ] } ``` |\n\n| Fields ||\n|-----------|--------------------------------------------------------------------------------------------------------------------------------|\n| `tasks[]` | `object (`[Task](/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/providers.tasks#Task)`)` The created Tasks. |\n\nCreateTaskRequest\n-----------------\n\nThe `tasks.create` request message.\n\n| JSON representation |\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"header\": { object (/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/DeliveryRequestHeader) }, \"parent\": string, \"taskId\": string, \"task\": { object (/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/providers.tasks#Task) } } ``` |\n\n| Fields ||\n|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `header` | `object (`[DeliveryRequestHeader](/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/DeliveryRequestHeader)`)` Optional. The standard Delivery API request header. |\n| `parent` | `string` Required. Must be in the format `providers/{provider}`. The `provider` must be the Google Cloud Project ID. For example, `sample-cloud-project`. |\n| `taskId` | `string` Required. The Task ID must be unique, but it should be not a shipment tracking ID. To store a shipment tracking ID, use the `trackingId` field. Note that multiple tasks can have the same `trackingId`. Task IDs are 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| `task` | `object (`[Task](/maps/documentation/mobility/fleet-engine/reference/tasks/rest/v1/providers.tasks#Task)`)` Required. The Task entity to create. When creating a Task, the following fields are required: - `type` - `state` (must be set to `OPEN`) - `trackingId` (must not be set for `UNAVAILABLE` or `SCHEDULED_STOP` tasks, but required for all other task types) - `plannedLocation` (optional for `UNAVAILABLE` tasks) - `taskDuration` The following fields can be optionally set: - `targetTimeWindow` - `taskTrackingViewConfig` - `attributes` Note: The Task's `name` field is ignored. All other Task fields must not be set; otherwise, an error is returned. |"]]