Search results

Integrate the component with Report Server

You can integrate Report Designer with Report Server to create, edit, browse and publish reports using the Report Server built-in API service.

  • The Report Designer requires the serviceAuthorizationToken to perform the API actions with Syncfusion Report Server. Create a token for the user by using the server RESTful API, the following code is used to generate the token.

  • Create a token for users by using the server RESTful API. The following code is used to generate the token.

    <script type="text/javascript">
            $(function () {
                var dataValue = "";
                var apiRequest = new Object();
                apiRequest.password = "demo";
                apiRequest.userid = "guest";
                $.ajax({
                    type: "POST",
                    url: "https://reportserver.syncfusion.com/api/get-user-key",
                    data: apiRequest,
                    success: function (data) {
                        dataValue = data.Token;
                        var token = JSON.parse(dataValue);
                        // Report Designer initialization.
                    }
                });
            });
    </script>
  • Set the Syncfusion Report Server built-in service URL to the serviceUrl property and assign the created token to serviceAuthorizationToken property. You can use the following complete code in your HTML page.

    <script type="text/javascript">
            $(function () {
                var dataValue = "";
                var apiRequest = new Object();
                apiRequest.password = "demo";
                apiRequest.userid = "guest";
                $.ajax({
                    type: "POST",
                    url: "https://reportserver.syncfusion.com/api/get-user-key",
                    data: apiRequest,
                    success: function (data) {
                        dataValue = data.Token;
                        var token = JSON.parse(dataValue);
    
                        $("#designer").ejReportDesigner(
                            {
                                serviceUrl: "https://reportserver.syncfusion.com/ReportService/api/Designer",
                                serviceAuthorizationToken: token["token_type"] + " " + token["access_token"]
                        });
                    }
                });
            });
    </script>
  • Build and run the application.