Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Operazioni a lunga esecuzione
L'API Submission è asincrona e restituisce un'operazione a lunga esecuzione. L'operazione potrebbe non essere completata quando il metodo restituisce una risposta.
Recupero dello stato di un'operazione
Di seguito viene mostrato come eseguire il polling dello stato di un'operazione.
Chiama il metodo GET per il tipo Operations.
Prima di utilizzare i dati della richiesta,
apporta le seguenti sostituzioni:
project-number: il numero del tuo progetto Google Cloud
operation-id: il tuo ID operazione
Metodo HTTP e URL:
GET https://webrisk.googleapis.com/v1/projects/project-number/operations/operation-id
Per inviare la richiesta, scegli una delle seguenti opzioni:
Al termine dell'operazione, viene restituito uno dei seguenti valori per state:
SUCCEEDED: indica che l'URL inviato è stato aggiunto alla lista bloccata di Navigazione sicura.
CLOSED: indica che non è stato rilevato che l'URL inviato viola le
norme di Navigazione sicura e che non è stato aggiunto alla lista bloccata di Navigazione sicura nelle ultime 24 ore.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-09 UTC."],[],[],null,["# Long-running Operations\n=======================\n\nThe Submission API is asynchronous and returns a long-running operation. The\noperation may not be completed when the method returns a response.\n\nGet an operation status\n-----------------------\n\nThe following shows how to poll an operation's status.\n\nCall the `GET` method for the Operations type.\n\n\nBefore using any of the request data,\nmake the following replacements:\n\n- \u003cvar translate=\"no\"\u003eproject-number\u003c/var\u003e: your Google Cloud project number\n- \u003cvar translate=\"no\"\u003eoperation-id\u003c/var\u003e: your operation ID\n\n\nHTTP method and URL:\n\n```\nGET https://webrisk.googleapis.com/v1/projects/project-number/operations/operation-id\n```\n\nTo send your request, choose one of these options: \n\n#### curl\n\n| **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](/sdk/gcloud/reference/init) or [`gcloud auth login`](/sdk/gcloud/reference/auth/login) , or by using [Cloud Shell](/shell/docs), which automatically logs you into the `gcloud` CLI . You can check the currently active account by running [`gcloud auth list`](/sdk/gcloud/reference/auth/list).\n\n\nExecute the following command:\n\n```\ncurl -X GET \\\n -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n \"https://webrisk.googleapis.com/v1/projects/project-number/operations/operation-id\"\n```\n\n#### PowerShell\n\n| **Note:** The following command assumes that you have logged in to the `gcloud` CLI with your user account by running [`gcloud init`](/sdk/gcloud/reference/init) or [`gcloud auth login`](/sdk/gcloud/reference/auth/login) . You can check the currently active account by running [`gcloud auth list`](/sdk/gcloud/reference/auth/list).\n\n\nExecute the following command:\n\n```\n$cred = gcloud auth print-access-token\n$headers = @{ \"Authorization\" = \"Bearer $cred\" }\n\nInvoke-WebRequest `\n -Method GET `\n -Headers $headers `\n -Uri \"https://webrisk.googleapis.com/v1/projects/project-number/operations/operation-id\" | Select-Object -Expand Content\n```\n\nYou should receive a JSON response similar to the following:\n\n```\n{\n \"name\": \"projects/project-number/operations/operation-id\",\n \"metadata\": {\n \"@type\": \"type.googleapis.com/google.cloud.webrisk.v1.SubmitUriMetadata\",\n \"state\": \"RUNNING\"\n }\n \"done\": false,\n ...\n}\n```\n\nWhen the operation is completed, one of the following values is returned for\n`state`:\n\n- `SUCCEEDED`: indicates that the submitted URL was added to the Safe Browsing\n Blocklist.\n\n- `CLOSED`: indicates that the submitted URL was not detected to violate the\n Safe Browsing Policies and was not added to the Safe Browsing Blocklist in the last 24 hours."]]