Hi,
I want to load server reports in ReportViewer.
I need to use Secured REST API resource as SSRS data source.
I couldn't find a way to call Secured REST resource from SSRS.
Additional information related to these are, we need to pass bearer token to REST resources since they are secured and need to authorized before access. We couldn't find a way to do the same in SSRS.
Highly appreciate if you can help on us to resolve this issue.
Thanks.
Query |
Response |
SSRS server report with rest api datasources |
We cannot change the SSRS server report datasource and we don’t have access to change. |
Syncfusion Report Server with Web API Datasource creation |
If you are trying to create the report with Web API datasource and view the report in Report Viewer means then you cane use the Syncfusion Web Report Designer with Web API.
Please find the below documentation link for your reference.
|
RDLC report with Web API datasource |
We can able to pass the Web API datasource for local saved RDL and RDLC report by setting the processing mode as local. We have prepared the simple sample in ASP.NET Core platform for your reference and it can be downloaded from below location.
Sample: http://www.syncfusion.com/downloads/support/directtrac/general/ze/ReportSample_core-809063459
Please find the below kb documentation for how to create a business object datasource report.
|
public partial class HomeController : Controller
{
public ActionResult Index()
{
ViewBag.ServiceAuthorizationToken = this.GenerateToken("http://localhost:58065/", "test", "Test@123");
return View();
}
public IActionResult Error()
{
return View();
}
[HttpPost]
public object PostParamData([FromBody]string stateCode)
{
var data = StoreSales.GetData(stateCode);
return data;
}
[HttpPost]
public object PostParamInt([FromBody]int id)
{
return null;
}
[HttpGet]
public object GetParamData(string stateCode)
{
var data = CustomerSales.GetData(stateCode);
return data;
}
[HttpGet]
public object GetData()
{
var data = StoreSales.GetData(string.Empty);
return data;
}
public string GenerateToken(string serverUrl, string userName, string password)
{
using (var client = new HttpClient())
{
client.BaseAddress = new Uri(serverUrl);
client.DefaultRequestHeaders.Accept.Clear();
var content = new FormUrlEncodedContent(new[]
{
new KeyValuePair<string, string>("grant_type", "password"),
new KeyValuePair<string, string>("username", userName),
new KeyValuePair<string, string>("password", password)
});
var result = client.PostAsync("/api/Token", content).Result;
string resultContent = result.Content.ReadAsStringAsync().Result;
var token = JsonConvert.DeserializeObject<Token>(resultContent);
return token.token_type + " " + token.access_token;
}
}
} |
@{
ViewData["Title"] = "ReportViewer ASP.NET CORE Support";
}
<style>
body, html, #reportviewer {
overflow: hidden !important;
height:100%;
width:100%;
}
</style>
<ej-report-viewer id="reportviewer" report-service-url="http://localhost:58065/ReportService/api/viewer" report-path="/webapi/WebAPITest" service-authorization-token="@ViewBag.ServiceAuthorizationToken" ></ej-report-viewer>
<ej-script-manager></ej-script-manager> |
public partial class HomeController : Controller
{
public ActionResult Index()
{
ViewBag.ServiceAuthorizationToken = this.GenerateToken("http://localhost:58065/", "test", "Test@123");
return View();
}
public IActionResult Error()
{
return View();
} |