REST Resource: operations
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ทรัพยากร: การดำเนินการ
ทรัพยากรนี้แสดงการดำเนินการที่ใช้เวลานานซึ่งเป็นผลมาจากการเรียก API เครือข่าย
การแสดง JSON |
{
"name": string,
"metadata": {
"@type": string,
field1: ...,
...
},
"done": boolean,
// Union field result can be only one of the following:
"error": {
object (Status )
},
"response": {
"@type": string,
field1: ...,
...
}
// End of list of possible types for union field result .
} |
ช่อง |
name |
string
ชื่อที่เซิร์ฟเวอร์กำหนด ซึ่งจะไม่ซ้ำกันเฉพาะในบริการเดียวกันที่ส่งคืนมาตั้งแต่แรกเท่านั้น หากคุณใช้การแมป HTTP เริ่มต้น name ควรเป็นชื่อทรัพยากรที่ลงท้ายด้วย operations/{unique_id}
|
metadata |
object
ช่องนี้จะมีออบเจ็กต์ DevicesLongRunningOperationMetadata หากการดำเนินการสร้างขึ้นโดย claimAsync , unclaimAsync หรือ updateMetadataAsync
ออบเจ็กต์ที่มีช่องประเภทที่กำหนดเอง ช่องเพิ่มเติม "@type" จะมี URI ที่ระบุประเภท ตัวอย่างเช่น { "id": 1234, "@type": "types.example.com/standard/id" }
|
done |
boolean
หากค่าเป็น false แสดงว่าการดำเนินการยังดำเนินอยู่ หากเป็น true การดำเนินการนี้จะเสร็จสมบูรณ์ และสามารถใช้ error หรือ response ได้
|
ช่องการรวม result ผลการดำเนินการ ซึ่งอาจเป็น error หรือ response ที่ถูกต้องก็ได้ หาก done == false จะไม่มีการตั้งค่าทั้ง error และ response หาก done == true อาจตั้งค่า error หรือ response ได้ 1 รายการ บริการบางอย่างอาจแสดงผลลัพธ์ไม่ได้ result ต้องเป็นค่าใดค่าหนึ่งต่อไปนี้ |
error |
object (Status )
จะไม่มีการตั้งค่าช่องนี้เสมอ หากการดำเนินการสร้างโดย claimAsync , unclaimAsync หรือ updateMetadataAsync ในกรณีนี้ ข้อมูลข้อผิดพลาดสำหรับอุปกรณ์แต่ละเครื่องจะตั้งค่าเป็น response.perDeviceStatus.result.status
|
response |
object
ช่องนี้จะมีออบเจ็กต์ DevicesLongRunningOperationResponse หากการดำเนินการสร้างขึ้นโดย claimAsync , unclaimAsync หรือ updateMetadataAsync
ออบเจ็กต์ที่มีช่องประเภทที่กำหนดเอง ช่องเพิ่มเติม "@type" จะมี URI ที่ระบุประเภท ตัวอย่างเช่น { "id": 1234, "@type": "types.example.com/standard/id" }
|
สถานะ
ประเภท Status
กำหนดโมเดลข้อผิดพลาดเชิงตรรกะที่เหมาะกับสภาพแวดล้อมในการเขียนโปรแกรมแบบต่างๆ ซึ่งรวมถึง REST API และ RPC API gRPC ใช้ ข้อความ Status
แต่ละข้อความจะมีข้อมูล 3 ส่วน ได้แก่ รหัสข้อผิดพลาด ข้อความแสดงข้อผิดพลาด และรายละเอียดข้อผิดพลาด
คุณสามารถดูข้อมูลเพิ่มเติมเกี่ยวกับรูปแบบข้อผิดพลาดนี้และวิธีใช้รูปแบบดังกล่าวได้ในคู่มือการออกแบบ API
การแสดง JSON |
{
"code": integer,
"message": string,
"details": [
{
"@type": string,
field1: ...,
...
}
]
} |
ช่อง |
code |
integer
รหัสสถานะ ซึ่งควรเป็นค่า enum ของ google.rpc.Code
|
message |
string
ข้อความแสดงข้อผิดพลาดที่นักพัฒนาแอปเห็น ซึ่งควรเป็นภาษาอังกฤษ ข้อความแสดงข้อผิดพลาดที่แสดงต่อผู้ใช้ควรแปลและส่งในช่อง google.rpc.Status.details หรือแปลโดยไคลเอ็นต์
|
details[] |
object
รายการข้อความที่มีรายละเอียดข้อผิดพลาด API จะใช้ชุดประเภทข้อความที่พบได้ทั่วไป ออบเจ็กต์ที่มีช่องประเภทที่กำหนดเอง ช่องเพิ่มเติม "@type" จะมี URI ที่ระบุประเภท ตัวอย่างเช่น { "id": 1234, "@type": "types.example.com/standard/id" }
|
เมธอด |
|
รับสถานะล่าสุดของการดำเนินการที่ใช้เวลานาน |
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[null,null,["อัปเดตล่าสุด 2025-07-25 UTC"],[[["\u003cp\u003eThis content defines the \u003ccode\u003eOperation\u003c/code\u003e resource, representing a long-running operation resulting from a network API call.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eOperation\u003c/code\u003e resource includes fields like \u003ccode\u003ename\u003c/code\u003e, \u003ccode\u003emetadata\u003c/code\u003e, and \u003ccode\u003edone\u003c/code\u003e, along with a union field \u003ccode\u003eresult\u003c/code\u003e that can be either an \u003ccode\u003eerror\u003c/code\u003e or a \u003ccode\u003eresponse\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eStatus\u003c/code\u003e resource defines a logical error model for APIs, including error \u003ccode\u003ecode\u003c/code\u003e, \u003ccode\u003emessage\u003c/code\u003e, and \u003ccode\u003edetails\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe provided methods for working with operations are limited to \u003ccode\u003eget\u003c/code\u003e, which allows retrieval of the latest state of a long running operation.\u003c/p\u003e\n"]]],["The content details two key components: `Operation` and `Status`. `Operation` represents a long-running API task, identified by a unique `name`. It tracks progress with a `done` boolean and provides either an `error` or `response` upon completion. `Status` defines the error model, containing an error `code`, `message`, and detailed `details`. The method described allows for getting the latest state of a long-running `operation`.\n"],null,[]]