Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Nesta página, explicamos como usar a APIs Explorer para testar os métodos da API Dataproc metastore. A API Explorer é um widget anexado à página de referência da API REST de um método. Ele aparece como um painel com o título Testar esta API.
O API Explorer é uma excelente maneira de testar métodos na API Monitoring sem precisar escrever nenhum código. O widget apresenta um formulário que mostra os parâmetros de cada método. Preencha o formulário, clique em Executar e veja os resultados.
Também é possível ocultar o widget clicando no botão "Fechar" na parte superior do painel ou expandi-lo para tela cheia clicando no botão "Tela cheia".
Antes de começar
Sign in to your Google Cloud account. If you're new to
Google Cloud,
create an account to evaluate how our products perform in
real-world scenarios. New customers also get $300 in free credits to
run, test, and deploy workloads.
In the Google Cloud console, on the project selector page,
select or create a Google Cloud project.
A maioria dos métodos tem alguns parâmetros obrigatórios e outros opcionais. Os obrigatórios são marcados com uma barra vermelha até serem preenchidos. É possível executar uma solicitação mínima fornecendo apenas os argumentos necessários.
O método services.create cria um serviço Metastore do Dataproc em um projeto e local escolhidos. Os campos obrigatórios são os campos parent e serviceId. Para criar um serviço, forneça o número do projeto e o código do local do pai usando o formulário projects/{projectNumber}/locations/{locationId}. E forneça o ID do serviço para serviceId.
Os resultados da invocação do método aparecem em uma caixa abaixo do botão Executar. Normalmente, a caixa tem um cabeçalho verde com o código de status HTTP 200, indicando que a solicitação foi bem-sucedida.
Se o cabeçalho estiver vermelho e contiver um código de falha HTTP, a caixa conterá a mensagem de erro. Consulte Dicas para ver dicas sobre como resolver erros.
Fornecer parâmetros adicionais
A lista de parâmetros que você vê depende do método ao qual o widget do API Explorer está anexado. O método services.create tem mais do que apenas os parâmetros parent e serviceId, mas eles são os únicos parâmetros obrigatórios.
Use o parâmetro opcional requestId para especificar um código de solicitação exclusivo para permitir que o servidor ignore a solicitação se ela for concluída.
Use campos para limitar ainda mais a saída.
Por padrão, o conjunto de parâmetros que o API Explorer mostra corresponde aos parâmetros do método associado. No entanto, o widget do API Explorer também tem um conjunto de campos adicionais que não estão disponíveis por meio do próprio método.
Esses parâmetros ficam ocultos na opção Exibir parâmetros padrão.
Clique nesse botão para expor os parâmetros adicionais do widget. Clique em Ocultar parâmetros padrão para ocultá-los.
O mais útil desses parâmetros padrão é o parâmetro fields, que permite selecionar os campos na saída retornada que você quer ver. Isso é muito útil no painel do API Explorer, em que a saída é exibida em uma caixa.
Geralmente, há muitas saídas para percorrer.
Dicas
As seções a seguir contêm dicas da API Explorer.
Lembre-se de alterar {projectNumber} and {locationId}
Não se esqueça de substituir {projectNumber} and {locationId} pelo número do projeto e pelo ID do local. Observe que a API também aceita o ID do projeto no lugar do número.
Problemas com os valores
Veja alguns problemas a serem observados ao usar os formulários do API Explorer. Esses erros podem causar erros ou ser aceitos, mas são tratados como erros de ortografia no método da API:
Não use aspas em valores de campo de qualquer tipo.
Não se esqueça de usar aspas nas strings que aparecem dentro de filtros. Use aspas duplas (") e não apóstrofos (').
Não use barras invertidas ou codificação de URL em campos de formulário. Se necessário, a codificação de URL é executada nos valores de campo quando você executa o método.
Observe o valor na caixa de resultado depois de executar a chamada. É possível notar o problema lá.
Digite um valor para o campo pageSize, como 2. Isso limita a quantidade de dados retornados à medida que você depura sua chamada de API.
Adicione URLs aos favoritos para depuração
Depois de receber a saída que você quer, adicione o URL do API Explorer aos favoritos. Para executar o método novamente, cole o URL no navegador. Você verá o formulário já preenchido com seus valores. Faça as alterações necessárias nos parâmetros e clique em Executar para executar o método novamente.
Authentication
Há uma seção de Autenticação na página do API Explorer, acima do botão Executar. Normalmente, você não precisa fazer alterações aqui.
O mecanismo de autenticação padrão é Google OAuth 2.0.
Há também um botão Mostrar escopos na seção Autenticação. Isso mostra quais escopos do Compute Engine estão disponíveis. Por padrão, todos os escopos disponíveis estão ativados.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-09-02 UTC."],[[["\u003cp\u003eAPI Explorer allows you to test Dataproc Metastore API methods directly from the REST API reference page without coding, using a form-based interface.\u003c/p\u003e\n"],["\u003cp\u003eYou can execute a minimal request by filling in only the required parameters, which are indicated by a red bar, and view the results directly below the Execute button.\u003c/p\u003e\n"],["\u003cp\u003eOptional parameters, including a unique request ID or using fields to filter output, can be used to customize the request beyond the basic required inputs.\u003c/p\u003e\n"],["\u003cp\u003eBe mindful of common formatting issues, such as avoiding quotation marks around values, properly quoting strings within filters, and not using backslashes or URL encoding in the form fields.\u003c/p\u003e\n"],["\u003cp\u003eThe API Explorer uses Google OAuth 2.0 by default for authentication, and you can bookmark URLs to save and reuse populated forms for debugging and re-execution.\u003c/p\u003e\n"]]],[],null,["# Use the API Explorer\n\nThis page explains how to use the API Explorer to try out\nDataproc Metastore API methods. API Explorer is a widget attached to\nthe REST API reference page for a method. It appears as a panel with the title\n**Try this API**.\n\nThe API Explorer is an excellent way to try out methods in the\nDataproc Metastore API without having to write any code. The\nwidget presents a form showing the parameters for each method. Fill in the form,\nclick **Execute**, and see the results.\n\nYou can also hide the widget by clicking the close button at the top of the\npanel, or expand it to full screen by clicking the full screen button.\n\nBefore you begin\n----------------\n\n- Sign in to your Google Cloud account. If you're new to Google Cloud, [create an account](https://console.cloud.google.com/freetrial) to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n\n\n Enable the Dataproc Metastore API.\n\n\n [Enable the API](https://console.cloud.google.com/flows/enableapi?apiid=metastore.googleapis.com)\n\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n\n\n Enable the Dataproc Metastore API.\n\n\n [Enable the API](https://console.cloud.google.com/flows/enableapi?apiid=metastore.googleapis.com)\n\n\u003cbr /\u003e\n\nAccess the API Explorer\n-----------------------\n\nThe API Explorer is attached to the reference page for each REST API method. To\nfind the widget, go to the reference page for a method, for example, the\n[reference page for Dataproc Metastore `projects.locations.services.create`](/dataproc-metastore/docs/reference/rest/v1/projects.locations.services/create).\n\nExecute a minimal request\n-------------------------\n\nMost methods have some required parameters and some optional ones. The required\nones are marked with a red bar until they are filled. You can execute a minimal\nrequest by supplying only the required arguments.\n\nThe `services.create` method creates a Dataproc Metastore service in a\nchosen project and location. The required fields are the **parent**\nand **serviceId** fields. To create a service, supply the project number and\nlocation ID of your project for **parent** using the form\n`projects/{projectNumber}/locations/{locationId}`. And supply the service ID for\n**serviceId**.\n\n[Try It!](/dataproc-metastore/docs/reference/rest/v1/projects.locations.services/create?apix_params=%7B%22parent%22%3A%22projects%2F%7BprojectNumber%7D%2Flocations%2F%7BlocationId%7D%22%7D)\n\nThe results of the method invocation appear in a box under the **Execute**\nbutton. Typically, the box has a green header with the HTTP status code `200` in\nit, indicating the request succeeded.\n\nIf the header is red and contains an HTTP failure code, the box contains\nthe error message. See [Tips](#api-explorer-tips) for pointers on resolving\nerrors.\n\nSupply additional parameters\n----------------------------\n\nThe list of parameters you see depends on the method to which the API Explorer\nwidget is attached. The `services.create` method has more than just the\n**parent** and **serviceId** parameters, but they are the only required\nparameters.\n\nYou can use the optional **requestId** parameter to specify a unique request ID\nto allow the server to ignore the request if it has completed.\n\nUse **fields** to limit output further\n--------------------------------------\n\nBy default, the set of parameters that API Explorer shows corresponds to\nthe parameters of the associated method. However, the API Explorer widget\nalso has a set of extra fields that are not available via the method itself.\n\nThese parameters are hidden under the toggle **Show standard parameters**.\n\nClick this toggle to expose the extra widget parameters. Click\n**Hide standard parameters** to hide them from view.\n\nThe most useful of these standard parameters is the **fields** parameter, which\nlets you select the fields in the returned output that you want to see. This is\nvery useful in the API Explorer panel, where the output is displayed in a box.\nThere is often a lot of output to scroll through.\n\nTips\n----\n\nThe following sections contain API Explorer tips.\n\n### Remember to change `{projectNumber} and {locationId}`\n\nDo not forget to replace `{projectNumber} and {locationId}` with your project's\nnumber and location ID. Note that the API also accepts the project ID in place\nof the number.\n\n### Problems with the values\n\nHere are some issues to watch for when using the API Explorer forms. These\nmistakes might cause errors or might be accepted but be treated like spelling\nerrors in the API method:\n\n- Don't use quotation marks around field values of any type.\n- Be sure to quote strings appearing inside filters. Use double quotation marks (`\"`) and not apostrophes (`'`).\n- Don't use backslashes or URL-encoding in form fields. If needed, URL-encoding is performed on the field values when you execute the method.\n- Look at the value in the result box after executing the call. You might notice the problem there.\n- Supply a value for the **pageSize** field, such as `2`. This limits the amount of data that is returned as you debug your API call.\n\n### Bookmark URLs for debugging\n\nAfter you get the output you want, bookmark the API Explorer URL. When you want\nto run the method again, paste the URL into your browser. You see the form\nalready populated with your values. Make any necessary changes to the\nparameters, and click **Execute** to run the method again.\n\n### Authentication\n\nThere is a **Credentials** section on the API Explorer page, above the\n**Execute** button. You typically don't need to change anything here.\n\nThe default authentication mechanism is `Google OAuth 2.0`.\n\nThere is also a **Show scopes** toggle in the **Credentials** section. This\nshows you which Compute Engine scopes you have available. By default,\nall available scopes are enabled.\n\nWhat's next\n-----------\n\n- [Dataproc Metastore API](/dataproc-metastore/docs/reference/rest)\n- [Enable the API](/dataproc-metastore/docs/enable-service)\n- [Quickstart for deploying Dataproc Metastore](/dataproc-metastore/docs/create-service-cluster)"]]