---
title: "レポートAPI"
slug: "reporting-api"
abstract: ""
---
# レポートAPI

以下の例は、Reporting APIを通じてReporting ServiceにT-SQLクエリを提出する方法を示しています:

using Sitecore.Configuration;
using Sitecore.Xdb.Reporting;

namespace Documentation.Examples
{
 class ReportingAPI
 {
 public void Example()
 {
 var provider = (ReportDataProvider)Factory.CreateObject("reporting/dataProvider", true);

 var query = new ReportDataQuery("select COUNT(visits) from fact\_downloads groupby asset\_id");

 string datasource = "reporting";

 ReportDataResponse response = provider.GetData(datasource, query, new CachingPolicy { NoCache = true });

 var datatable = response.GetDataTable();
 }
 }
}

> !注Reporting APIには、サービスがデータテーブルしか返してこないこと、そしてSQLの入出力パラメータは使えないという制限があります。