Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Để chạy truy vấn, hãy gửi yêu cầu queries.run cùng với thuộc tính
queryId và thông tin chi tiết về quá trình thực thi. Yêu cầu này trả về một
đang chạy tài nguyên Report.
Dưới đây là cách chạy truy vấn và truy xuất mã tài nguyên báo cáo thu được:
Java
// ID of query to run.LongqueryId=query-id;// Run the query.Reportreport=service.queries().run(queryId,null).execute();// Print the running report ID.System.out.printf("Report %s generated and running.%n",report.getKey().getReportId());
Python
# The ID of the existing query.query_id=query-id# Run the query.running_report=(service.queries().run(queryId=query_id).execute())# Print running report ID.print(f'Report {running_report["key"]["reportId"]} generated and running.')
PHP
// ID of the query to run.$queryId = query-id;// Run the query.$report = $this->service->queries->run( $queryId, new Google_Service_DoubleClickBidManager_RunQueryRequest(), array());// Print the running report IDprintf( 'Report %s generated and running.<br>', $report->getKey()->getReportId());
[null,null,["Cập nhật lần gần đây nhất: 2025-08-31 UTC."],[[["\u003cp\u003eSend a \u003ccode\u003equeries.run\u003c/code\u003e request with the \u003ccode\u003equeryId\u003c/code\u003e and execution details to run a query which will return a running \u003ccode\u003eReport\u003c/code\u003e resource.\u003c/p\u003e\n"],["\u003cp\u003eSchedule \u003ccode\u003eQuery\u003c/code\u003e resources for automatic execution using the \u003ccode\u003eschedule\u003c/code\u003e field during creation, and retrieve reports using \u003ccode\u003equeries.reports.list\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe provided Java, Python, and PHP code snippets demonstrate how to run a query and retrieve the resulting report resource ID.\u003c/p\u003e\n"]]],[],null,["# Run query\n\nTo run a query, send a [`queries.run`](/bid-manager/reference/rest/current/queries/run) request with the\n[`queryId`](/bid-manager/reference/rest/current/queries#Query.FIELDS.query_id) and execution details. This request returns a\nrunning [`Report`](/bid-manager/reference/rest/current/queries.reports#Report) resource.\n| **Tip:** Schedule [`Query`](/bid-manager/reference/rest/current/queries#Query) resources to run automatically using the [`schedule`](/bid-manager/reference/rest/current/queries#Query.FIELDS.schedule) field during creation. Retrieve reports generated by scheduled queries using [`queries.reports.list`](/bid-manager/reference/rest/current/queries/list).\n\nHere's how to run a query and retrieve the resulting report resource ID: \n\n### Java\n\n```java\n// ID of query to run.\nLong queryId = query-id;\n\n// Run the query.\nReport report = service.queries().run(queryId, null).execute();\n\n// Print the running report ID.\nSystem.out.printf(\n \"Report %s generated and running.%n\",\n report.getKey().getReportId());\n```\n\n### Python\n\n```python\n# The ID of the existing query.\nquery_id = query-id\n\n# Run the query.\nrunning_report = (\n service.queries().run(queryId=query_id).execute()\n)\n\n# Print running report ID.\nprint(f'Report {running_report[\"key\"][\"reportId\"]} generated and running.')\n```\n\n### PHP\n\n```php\n// ID of the query to run.\n$queryId = \u003cvar translate=\"no\"\u003equery-id\u003c/var\u003e;\n\n// Run the query.\n$report = $this-\u003eservice-\u003equeries-\u003erun(\n $queryId,\n new Google_Service_DoubleClickBidManager_RunQueryRequest(),\n array());\n\n// Print the running report ID\nprintf(\n 'Report %s generated and running.\u003cbr\u003e',\n $report-\u003egetKey()-\u003egetReportId());\n```"]]