Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Auf dieser Seite wird beschrieben, wie Sie Ressourcen für Vorgänge mit langer Ausführungszeit, die von Methoden in Service Infrastructure APIs wie service.rollouts.create zurückgegeben werden, programmatisch abfragen.
Wenn ein Vorgang abgeschlossen ist, wird das Feld done auf "true" gesetzt.
Wenn Sie einen Vorgang abfragen möchten, rufen Sie die Methode operations.get wiederholt und vorzugsweise mit einem Backoff von zehn Sekunden auf, bis der Vorgang abgeschlossen ist:
# This is an example of getting a pending `Operation` resource.gcurlhttps://servicemanagement.googleapis.com/v1/operations/rollouts.endpointsapis.appspot.com:2016-07-16r2{"name":"operations/rollouts.endpointsapis.appspot.com:2016-07-16r2","metadata":{"@type":"type.googleapis.com/google.api.servicemanagement.v1.OperationMetadata","resourceNames":["services/endpointsapis.appspot.com/rollouts/2016-07-16r2"],"steps":[{"description":"update Service Controller","status":"In_PROGRESS"}],"progressPercentage":0,"startTime":"2016-07-16T00:56:55.737Z",}"response":{"@type":"type.googleapis.com/google.api.servicemanagement.v1.Rollout","rolloutId":"2016-07-16r2","createTime":"2016-07-16T00:56:55.724Z","serviceSelectionStrategy":{"serviceConfigIds":["2016-07-16r1"]},"serviceName":"endpointsapis.appspot.com"}# This is an example of getting a done `Operation` resource.gcurlhttps://servicemanagement.googleapis.com/v1/operations/rollouts.endpointsapis.appspot.com:2016-07-16r2{"name":"operations/rollouts.endpointsapis.appspot.com:2016-07-16r2","metadata":{"@type":"type.googleapis.com/google.api.servicemanagement.v1.OperationMetadata","resourceNames":["services/endpointsapis.appspot.com/rollouts/2016-07-16r2"],"steps":[{"description":"update Service Controller","status":"Done"}],"progressPercentage":100,"startTime":"2016-07-16T00:56:55.737Z",}"done":true,"response":{"@type":"type.googleapis.com/google.api.servicemanagement.v1.Rollout","rolloutId":"2016-07-16r2","createTime":"2016-07-16T00:56:55.724Z","serviceSelectionStrategy":{"serviceConfigIds":["2016-07-16r1"]},"serviceName":"endpointsapis.appspot.com"}
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-03 (UTC)."],[],[],null,["# Polling Long Running Operations\n\nThis page describes how to programmatically poll the long-running\n[operation](/service-infrastructure/docs/glossary#operation) resources returned by methods in\nService Infrastructure APIs that take a substantial amount of time to complete, such\nas\n[`service.rollouts.create`](/service-infrastructure/docs/service-management/reference/rest/v1/services.rollouts/create).\nAfter an operation is done, the `done` field will be set to true.\n| **Note:** While you typically interact with long-running [operations](/service-infrastructure/docs/service-management/reference/rest/v1/operations) as a result of calling methods in the Service Management API, the Service Consumer Management API also provides methods for interacting with long-running operation resources, such as [`operations.get`](/service-infrastructure/docs/service-consumer-management/reference/rest/v1/operations/get).\n\nTo poll an operation, repeatedly invoke the\n[`operations.get`](/service-infrastructure/docs/service-management/reference/rest/v1/operations/get)\nmethod with a recommended 10 seconds backoff until the operation is done: \n\n # This is an example of getting a pending `Operation` resource.\n gcurl https://servicemanagement.googleapis.com/v1/operations/rollouts.endpointsapis.appspot.com:2016-07-16r2\n {\n \"name\": \"operations/rollouts.endpointsapis.appspot.com:2016-07-16r2\",\n \"metadata\": {\n \"@type\": \"type.googleapis.com/google.api.servicemanagement.v1.OperationMetadata\",\n \"resourceNames\": [\n \"services/endpointsapis.appspot.com/rollouts/2016-07-16r2\"\n ],\n \"steps\": [\n {\n \"description\": \"update Service Controller\",\n \"status\": \"In_PROGRESS\"\n }\n ],\n \"progressPercentage\": 0,\n \"startTime\": \"2016-07-16T00:56:55.737Z\",\n }\n \"response\": {\n \"@type\": \"type.googleapis.com/google.api.servicemanagement.v1.Rollout\",\n \"rolloutId\": \"2016-07-16r2\",\n \"createTime\": \"2016-07-16T00:56:55.724Z\",\n \"serviceSelectionStrategy\": {\n \"serviceConfigIds\": [\n \"2016-07-16r1\"\n ]\n },\n \"serviceName\": \"endpointsapis.appspot.com\"\n }\n\n # This is an example of getting a done `Operation` resource.\n gcurl https://servicemanagement.googleapis.com/v1/operations/rollouts.endpointsapis.appspot.com:2016-07-16r2\n {\n \"name\": \"operations/rollouts.endpointsapis.appspot.com:2016-07-16r2\",\n \"metadata\": {\n \"@type\": \"type.googleapis.com/google.api.servicemanagement.v1.OperationMetadata\",\n \"resourceNames\": [\n \"services/endpointsapis.appspot.com/rollouts/2016-07-16r2\"\n ],\n \"steps\": [\n {\n \"description\": \"update Service Controller\",\n \"status\": \"Done\"\n }\n ],\n \"progressPercentage\": 100,\n \"startTime\": \"2016-07-16T00:56:55.737Z\",\n }\n \"done\": true,\n \"response\": {\n \"@type\": \"type.googleapis.com/google.api.servicemanagement.v1.Rollout\",\n \"rolloutId\": \"2016-07-16r2\",\n \"createTime\": \"2016-07-16T00:56:55.724Z\",\n \"serviceSelectionStrategy\": {\n \"serviceConfigIds\": [\n \"2016-07-16r1\"\n ]\n },\n \"serviceName\": \"endpointsapis.appspot.com\"\n }"]]