Beberapa produk dan fitur sedang dalam proses penggantian nama. Fitur playbook dan alur generatif juga dimigrasikan ke satu konsol gabungan. Lihat detailnya.
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Saat mencantumkan data dengan API,
beberapa permintaan metode daftar menyediakan kolom filter.
Anda dapat menggunakan filter ini untuk hanya menampilkan hasil yang Anda minati.
Fitur pemfilteran ini umum di banyak Google Cloud API.
Contoh berikut menunjukkan cara memfilter respons
saat mencantumkan hasil kasus pengujian.
importcom.google.cloud.dialogflow.cx.v3.ListTestCaseResultsRequest;importcom.google.cloud.dialogflow.cx.v3.ListTestCaseResultsRequest.Builder;importcom.google.cloud.dialogflow.cx.v3.TestCaseResult;importcom.google.cloud.dialogflow.cx.v3.TestCasesClient;importcom.google.cloud.dialogflow.cx.v3.TestCasesSettings;importjava.io.IOException;publicclassListTestCaseResults{publicstaticvoidmain(String[]args)throwsIOException{// TODO(developer): Replace these variables before running the sample.StringprojectId="my-project-id";StringagentId="my-agent-id";StringtestId="my-test-id";Stringlocation="my-location";listTestCaseResults(projectId,agentId,testId,location);}publicstaticvoidlistTestCaseResults(StringprojectId,StringagentId,StringtestId,Stringlocation)throwsIOException{Stringparent="projects/"+projectId+"/locations/"+location+"/agents/"+agentId+"/testCases/"+testId;Builderreq=ListTestCaseResultsRequest.newBuilder();req.setParent(parent);req.setFilter("environment=draft");TestCasesSettingstestCasesSettings=TestCasesSettings.newBuilder().setEndpoint(location+"-dialogflow.googleapis.com:443").build();// Note: close() needs to be called on the TestCasesClient object to clean up resources// such as threads. In the example below, try-with-resources is used,// which automatically calls close().try(TestCasesClientclient=TestCasesClient.create(testCasesSettings)){for(TestCaseResultelement:client.listTestCaseResults(req.build()).iterateAll()){System.out.println(element);}}}}
fromgoogle.cloud.dialogflowcx_v3.services.test_cases.clientimportTestCasesClientfromgoogle.cloud.dialogflowcx_v3.types.test_caseimportListTestCaseResultsRequestdeflist_test_case(project_id,agent_id,test_id,location):req=ListTestCaseResultsRequest()req.parent=f"projects/{project_id}/locations/{location}/agents/{agent_id}/testCases/{test_id}"req.filter="environment=draft"client=TestCasesClient(client_options={"api_endpoint":f"{location}-dialogflow.googleapis.com"})# Makes a call to list all test case results that match filterresult=client.list_test_case_results(request=req)print(result)returnresult
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-09-04 UTC."],[[["\u003cp\u003eMany Google Cloud APIs, including Dialogflow, allow you to filter list method requests using a \u003ccode\u003efilter\u003c/code\u003e field to narrow down the results you get.\u003c/p\u003e\n"],["\u003cp\u003eThe provided examples demonstrate how to filter test case results in Dialogflow using Java, Node.js, and Python.\u003c/p\u003e\n"],["\u003cp\u003eWhen listing test case results, you can set a filter such as \u003ccode\u003eenvironment=draft\u003c/code\u003e to retrieve specific data.\u003c/p\u003e\n"],["\u003cp\u003eYou can make use of Application Default Credentials to properly authenticate with Dialogflow APIs.\u003c/p\u003e\n"]]],[],null,["# List data with a filter\n\nWhen listing data with the API,\nsome list method requests provide a `filter` field.\nYou can use these filters to only return results you are interested in.\nThis\n[filtering feature](https://google.aip.dev/160)\nis common across many Google Cloud APIs.\n\nThe following examples show how to filter the response\nwhen listing test case results. \n\n### Java\n\n\nTo authenticate to Dialogflow, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n\n import com.google.cloud.dialogflow.cx.v3.https://cloud.google.com/java/docs/reference/google-cloud-dialogflow-cx/latest/com.google.cloud.dialogflow.cx.v3.ListTestCaseResultsRequest.html;\n import com.google.cloud.dialogflow.cx.v3.https://cloud.google.com/java/docs/reference/google-cloud-dialogflow-cx/latest/com.google.cloud.dialogflow.cx.v3.ListTestCaseResultsRequest.html.Builder;\n import com.google.cloud.dialogflow.cx.v3.https://cloud.google.com/java/docs/reference/google-cloud-dialogflow-cx/latest/com.google.cloud.dialogflow.cx.v3.TestCaseResult.html;\n import com.google.cloud.dialogflow.cx.v3.https://cloud.google.com/java/docs/reference/google-cloud-dialogflow-cx/latest/com.google.cloud.dialogflow.cx.v3.TestCasesClient.html;\n import com.google.cloud.dialogflow.cx.v3.https://cloud.google.com/java/docs/reference/google-cloud-dialogflow-cx/latest/com.google.cloud.dialogflow.cx.v3.TestCasesSettings.html;\n import java.io.IOException;\n\n public class ListTestCaseResults {\n\n public static void main(String[] args) throws IOException {\n // TODO(developer): Replace these variables before running the sample.\n String projectId = \"my-project-id\";\n String agentId = \"my-agent-id\";\n String testId = \"my-test-id\";\n String location = \"my-location\";\n listTestCaseResults(projectId, agentId, testId, location);\n }\n\n public static void listTestCaseResults(\n String projectId, String agentId, String testId, String location) throws IOException {\n String parent =\n \"projects/\"\n + projectId\n + \"/locations/\"\n + location\n + \"/agents/\"\n + agentId\n + \"/testCases/\"\n + testId;\n\n Builder req = https://cloud.google.com/java/docs/reference/google-cloud-dialogflow-cx/latest/com.google.cloud.dialogflow.cx.v3.ListTestCaseResultsRequest.html.newBuilder();\n\n req.setParent(parent);\n req.setFilter(\"environment=draft\");\n\n https://cloud.google.com/java/docs/reference/google-cloud-dialogflow-cx/latest/com.google.cloud.dialogflow.cx.v3.TestCasesSettings.html testCasesSettings =\n https://cloud.google.com/java/docs/reference/google-cloud-dialogflow-cx/latest/com.google.cloud.dialogflow.cx.v3.TestCasesSettings.html.newBuilder()\n .setEndpoint(location + \"-dialogflow.googleapis.com:443\")\n .build();\n\n // Note: close() needs to be called on the TestCasesClient object to clean up resources\n // such as threads. In the example below, try-with-resources is used,\n // which automatically calls close().\n try (https://cloud.google.com/java/docs/reference/google-cloud-dialogflow-cx/latest/com.google.cloud.dialogflow.cx.v3.TestCasesClient.html client = https://cloud.google.com/java/docs/reference/google-cloud-dialogflow-cx/latest/com.google.cloud.dialogflow.cx.v3.TestCasesClient.html.create(testCasesSettings)) {\n for (https://cloud.google.com/java/docs/reference/google-cloud-dialogflow-cx/latest/com.google.cloud.dialogflow.cx.v3.TestCaseResult.html element : client.listTestCaseResults(req.build()).iterateAll()) {\n System.out.println(element);\n }\n }\n }\n }\n\n### Node.js\n\n\nTo authenticate to Dialogflow, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n const parent = `projects/${projectId}/locations/${location}/agents/${agentId}/testCases/${testId}`;\n\n const {TestCasesClient} = require('https://cloud.google.com/nodejs/docs/reference/dialogflow-cx/latest/overview.html');\n\n const client = new https://cloud.google.com/nodejs/docs/reference/dialogflow-cx/latest/overview.html({\n apiEndpoint: 'global-dialogflow.googleapis.com',\n });\n const req = {\n parent,\n filter: 'environment=draft',\n };\n\n const res = await client.listTestCaseResults(req);\n\n console.log(res);\n\n### Python\n\n\nTo authenticate to Dialogflow, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n\n from google.cloud.dialogflowcx_v3.services.test_cases.client import TestCasesClient\n from google.cloud.dialogflowcx_v3.types.test_case import ListTestCaseResultsRequest\n\n\n def list_test_case(project_id, agent_id, test_id, location):\n req = ListTestCaseResultsRequest()\n req.parent = f\"projects/{project_id}/locations/{location}/agents/{agent_id}/testCases/{test_id}\"\n req.filter = \"environment=draft\"\n client = TestCasesClient(\n client_options={\"api_endpoint\": f\"{location}-dialogflow.googleapis.com\"}\n )\n # Makes a call to list all test case results that match filter\n result = client.list_test_case_results(request=req)\n print(result)\n return result\n\n\u003cbr /\u003e"]]