Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Endpoint globali e multiregionali
Cloud Translation - Advanced offre un endpoint globale, nonché endpoint multiregionali per l'UE e gli Stati Uniti:
translate.googleapis.com (globale)
translate-eu.googleapis.com
translate-us.googleapis.com
Se utilizzi un endpoint multiregionale, i dati archiviati e l'elaborazione di machine learning
rimangono all'interno dei confini continentali dell'UE o degli Stati Uniti. Questi
endpoint multiregionali sono importanti se la posizione dei tuoi dati deve essere
controllata per rispettare i requisiti normativi locali.
Se non specifichi un endpoint, Cloud Translation - Advanced utilizza l'endpoint globale per impostazione predefinita.
Endpoint globali e multiregionali
Quando utilizzi un endpoint multiregionale, ci sono alcune differenze rispetto all'utilizzo dell'endpoint globale:
Le traduzioni di testo che utilizzano modelli AutoML personalizzati non sono supportate.
Puoi utilizzare solo il modello NMT preaddestrato.
Le funzionalità non GA (ancora in anteprima) non sono supportate.
Le chiamate tramite l'endpoint globale non possono accedere alle risorse create utilizzando un endpoint multiregionale. Allo stesso modo, le chiamate tramite un endpoint multiregionale non possono accedere alle risorse create utilizzando l'endpoint globale.
Limitazione delle località delle risorse
Gli amministratori delle policy dell'organizzazione possono limitare le regioni disponibili per le risorse Cloud Translation - Advanced creando un vincolo di località delle risorse. Se
impostato, gli utenti di Cloud Translation - Advanced potranno creare risorse solo in una
posizione specifica.
Limitazione dell'utilizzo dell'endpoint API globale
Per contribuire a imporre l'utilizzo di endpoint regionali, gli amministratori delle policy dell'organizzazione possono utilizzare il vincolo delle policy dell'organizzazione constraints/gcp.restrictEndpointUsage per bloccare le richieste all'endpoint API globale. Per ulteriori
informazioni, vedi Limitare l'utilizzo
dell'endpoint.
Specifica un endpoint
L'esempio seguente mostra una traduzione di testo che utilizza un endpoint multiregionale. Se utilizzi le librerie client, imposta l'endpoint API come parte delle opzioni client. Per alcuni esempi, consulta Impostazione della località utilizzando le librerie client nella guida all'API Cloud Natural Language.
REST
Prima di utilizzare i dati della richiesta,
apporta le seguenti sostituzioni:
PROJECT_NUMBER_OR_ID: l'ID numerico o alfanumerico del tuo Google Cloud progetto
ENDPOINT: endpoint regionale, che determina la posizione dei dati. Ad esempio, translate-eu.googleapis.com.
LOCATION: la regione in cui vuoi eseguire questa operazione. Devi
scegliere una regione all'interno del confine continentale dell'endpoint regionale. Ad
esempio, se utilizzi l'endpoint translate-eu.googleapis.com,
specifica una regione in Europa, ad esempio europe-west1.
Metodo HTTP e URL:
POST https://ENDPOINT/v3/projects/PROJECT_NUMBER_OR_ID/locations/LOCATION:translateText
[[["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-04 UTC."],[],[],null,["# Global and multi-regional endpoints\n===================================\n\nCloud Translation - Advanced offers a global endpoint as well as EU and US\nmulti-regional endpoints:\n\n- `translate.googleapis.com` (global)\n- `translate-eu.googleapis.com`\n- `translate-us.googleapis.com`\n\nIf you use a multi-regional endpoint, your data at-rest and machine learning\nprocessing stays within the continental boundaries of the EU or US. These\nmulti-regional endpoints are important if your data's location must be\ncontrolled to comply with local regulatory requirements.\n\nIf you don't specify an endpoint, Cloud Translation - Advanced uses the global\nendpoint by default.\n\nGlobal versus multi-regional endpoints\n--------------------------------------\n\nWhen using a multi-regional endpoint, there are some difference when compared to\nusing the global endpoint:\n\n- Text translations that use custom AutoML models are not supported. You can use only the pre-trained NMT model.\n- Features that are not GA (still in [Preview](/products#product-launch-stages)) are not supported.\n- Calls through the global endpoint cannot access resources that were created by using a multi-regional endpoint. Similarly, calls through a multi-regional endpoint cannot access resources that were created by using the global endpoint.\n\nRestricting resource locations\n------------------------------\n\nOrganization policy administrators can restrict the regions available for\nCloud Translation - Advanced resources by [creating a resource locations\nconstraint](/resource-manager/docs/organization-policy/defining-locations). If\nset, Cloud Translation - Advanced users would be able to create resources only in a\nparticular location.\n\nRestricting global API endpoint usage\n-------------------------------------\n\nTo help enforce the use of regional endpoints, organization policy\nadministrators can use the `constraints/gcp.restrictEndpointUsage` organization\npolicy constraint to block requests to the global API endpoint. For more\ninformation, see [Restricting endpoint\nusage](/assured-workloads/docs/restrict-endpoint-usage).\n\nSpecify an endpoint\n-------------------\n\nThe following example shows a text translation that uses a multi-regional\nendpoint. If you use the client libraries, set the API endpoint as part of the\nclient options. For some examples, see [Setting the location using client\nlibraries](/natural-language/docs/locations#setting_the_location_using_client_libraries)\nin the Cloud Natural Language API guide. \n\n### REST\n\n\nBefore using any of the request data,\nmake the following replacements:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_NUMBER_OR_ID\u003c/var\u003e: the numeric or alphanumeric ID of your Google Cloud project\n- \u003cvar translate=\"no\"\u003eENDPOINT\u003c/var\u003e: Regional endpoint, which determines where your data resides. For example, `translate-eu.googleapis.com`.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: Region where you want to run this operation. You must pick a region inside the continental boundary of the regional endpoint. For example, if you use the `translate-eu.googleapis.com` endpoint, specify a region in Europe such as `europe-west1`.\n\n\nHTTP method and URL:\n\n```\nPOST https://ENDPOINT/v3/projects/PROJECT_NUMBER_OR_ID/locations/LOCATION:translateText\n```\n\n\nRequest JSON body:\n\n```\n{\n \"model\": \"projects/PROJECT_NUMBER_OR_ID/locations/LOCATION/models/general/base\",\n \"sourceLanguageCode\": \"en\",\n \"targetLanguageCode\": \"de\",\n \"contents\": [\"Come here!\"]\n}\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\nSave the request body in a file named `request.json`,\nand execute the following command:\n\n```\ncurl -X POST \\\n -H \"Authorization: Bearer $(gcloud auth print-access-token)\" \\\n -H \"x-goog-user-project: PROJECT_NUMBER_OR_ID\" \\\n -H \"Content-Type: application/json; charset=utf-8\" \\\n -d @request.json \\\n \"https://ENDPOINT/v3/projects/PROJECT_NUMBER_OR_ID/locations/LOCATION:translateText\"\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\nSave the request body in a file named `request.json`,\nand execute the following command:\n\n```\n$cred = gcloud auth print-access-token\n$headers = @{ \"Authorization\" = \"Bearer $cred\"; \"x-goog-user-project\" = \"PROJECT_NUMBER_OR_ID\" }\n\nInvoke-WebRequest `\n -Method POST `\n -Headers $headers `\n -ContentType: \"application/json; charset=utf-8\" `\n -InFile request.json `\n -Uri \"https://ENDPOINT/v3/projects/PROJECT_NUMBER_OR_ID/locations/LOCATION:translateText\" | Select-Object -Expand Content\n```\n\nYou should receive a JSON response similar to the following:\n\n```\n{\n \"translations\": [\n {\n \"translatedText\": \"Komm her!\",\n \"model\": \"projects/PROJECT_NUMBER_OR_ID/locations/LOCATION/models/general/base\"\n }\n ]\n}\n```\n\n\u003cbr /\u003e"]]