We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Starting in 2019, the Reporting control is no longer included in Essential Studio. If you're experiencing issues with the Syncfusion Reporting Platform, Report Viewer, Report Designer, or Report Writer, we recommend migrating to Bold Reports, our dedicated reporting platform.

Bold Reports offers a comprehensive suite of tools and features for all your reporting needs, and we will help you make a smooth transition from the discontinued control. Our support team at https://support.boldreports.com/ is here to assist you with any questions or difficulties you may encounter during the migration process.

We thank you for choosing Syncfusion and appreciate your understanding.

How to use Secured REST API resource as SSRS data source

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.


9 Replies

MM Mageshyadav M Syncfusion Team March 11, 2019 12:02 PM UTC

Hi Chiranjiv, 
 
Please find the response for your queries. 
 
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. 
 
Please find the below kb documentation for how to create a business object datasource report. 
 
Regards, 
Mageshyadav.M 



CH chiranjiv March 11, 2019 02:21 PM UTC

yes i agree with your response but i want to run server reports.

I want to use processing mode as Remote and Report Server should authorize my REST API used for report data Source.


MM Mageshyadav M Syncfusion Team March 12, 2019 03:14 PM UTC

Hi Chiranjiv, 
  
Yes, your requirement is possible using extension datasource and you can authorize your Rest API in that extension. We will update you the ReportViewer sample running report server reports which has been designed in Web Designer with using WebAPI datasource on March 13, 2019 for your reference. 
  
Regards, 
Mageshyadav.M 



CH chiranjiv March 13, 2019 04:57 AM UTC

Thanks it will be a great help.


CH chiranjiv March 14, 2019 08:04 AM UTC

Hi,
Waiting for your response. Any updates?


MS Mahendran Shanmugam Syncfusion Team March 14, 2019 02:23 PM UTC

Hi Chiranjiv, , 

Sorry for the delay. 

We are getting some issue when creating the sample with your requirement. So we will update the sample on tomorrow without fail. 

Regards, 
Mahendran S. 



MM Mageshyadav M Syncfusion Team March 15, 2019 12:57 PM UTC

Hi Chiranjiv, 
 
Thanks for your patience. 
 
We have prepared the sample with WebAPI datasource and running the Report Server report in ASP.NET Core application and it can be downloaded from below location. 
 
In above sample, we have prepared the WepAPI datasource in HomeController class file as shown in below code example 
HomeController.cs 
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; 
            } 
        } 
    } 
 
Please find the below steps for how to use the WebAPI datasource in Report server. 
 
Step 1: Run the above attached sample. 
 
Step 2: Copy the URL for that sample as shown in below snap since we have created WebAPI datasource in same sample. 
 
 
Step 3: Open the Web report designer from server, create new datasource, choose WebAPI option and pass the above copied URL as shown in below code example. 
 
 
 
Step 4: Go to dataset dialog and provide the method in Web API datasource as shown in below snap. For reference on how to form the query, please refer this help link,  
 
 
 
Step 5 : Create any report item with dataset fields and save that report in report server. 
Step 6: Stop the above running sample. 
Step 7: Pass your Report server URL, newly created report path and Service authorization token as shown in below code example. 
Index.cshtml 
@{ 
    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> 
 
Step 8: Pass your Report server URL, Username and password to get the service authorization token in HomeController class file as shown in below code example. 
HomeController.cs 
    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(); 
        } 
 
We have prepared the simple RDL with above sample Web API datsource and it can be downloaded from below location. Could you please add this RDL in your report server and run the sample with that report path. 
 
Regards, 
Mageshyadav.M 



CH chiranjiv March 18, 2019 05:09 AM UTC

Thank you so much


MM Mageshyadav M Syncfusion Team March 18, 2019 10:48 AM UTC

Hi Chiranjiv, 
  
Thanks for your acknowledgment. 
  
Please let us know in case of any queries in provided solution. 
  
Regards, 
Mageshyadav.M 


Loader.
Live Chat Icon For mobile
Up arrow icon