API to get Dashboard parameters and its values

Hi,

My question would be, that is there an API available to get the possible Dashboard parameter names and the possible values which could be further used in the ejDashboardViewer's filterParameters option? This is needed to let our Users set up the parameters more effectively for the Dashboard Viewer.

Thanks in advance,
Bondor Tamas

13 Replies

SU Suriya Syncfusion Team September 27, 2018 11:20 AM UTC

 Hi Bondor Tamas, 

Yes, you can get the parameter(s) information of a dashboard file by using the below code snippet (where the dashboard viewer is embedded): 
<body style="width: 100%;height: 100%"> 
                <script type="text/javascript"> 
                $(function (e) { 
                   var url ="https://dashboardsdk.syncfusion.com/DashboardService/DashboardService.svc";      // Replace with your Dashboard Service link 
                     var report = "https://dashboardsdkdemo.syncfusion.com/Dashboards/Northwind%20Product%20Sales%20Analysis.sydx"; //Replace with your Dashboard File path 
                  $("#dashboard").ejDashboardViewer({ 
                   serviceUrl: url, 
                   dashboardPath:report, 
                    beforeLayoutRender:"beforeLayoutRender" 
                  }); 
            }); 
                 
                /* Get the Parameter(s) information before dashboard layout rendered*/ 
                function beforeLayoutRender(args){ 
                    //Args contain the dashboard parameter(s) information of the dashboard (SYDX) file which you passed to the Viewer. 
                    var dashboardParameter = args.dashboardParameters;  
                    for(var i = 0; i < dashboardParameter.data.length; i++){ 
                      if(dashboardParameter.data[i].parameterName === "Parameter1"){ //Where Parameter1 is the name of the Parameter in SYDX file. 
                                dashboardParameter.data[i].value = "WILMK"; //Value of the Parameter1 
                     
                  
               
                </script> 
    <div id="dashboard" style="width: 100%; height: 100%" ></div> 
    </body> 
 

Also, find the sample HTML file here

If you have embedded the Dashboard Server’s dashboard then, you can get the parameter(s) information of respective dashboard using below REST API. 

Regards, 
Suriya 



BT Bondor Tamas September 28, 2018 11:20 AM UTC

Hi Suriya,

Thanks for the quick response and for the demo. 
Please can you assist me with two more questions?

1. 
I wanted to ask if there is a similar way to get the Filter parameters, those are the values that we would like to send with the FilterParameters option.
I want to access these: http://take.ms/HdsaG and not just the parameters 

2.
How could I apply filters from ejDashboardViewer in the demo that you provided? I couldn't make it work... Can you please show me in your demo, how to filter for example the Select Year from the JS code: http://take.ms/nXsI9 and how can I modify from the JS code the Parameter1 value? Also do parameters like Parameter1 have an effect on filtering?

Thank you a lot in advance


BT Bondor Tamas September 28, 2018 11:25 AM UTC

Hi Suriya, 
I forgot to add to the last comment: The endpoint that you mentioned in your answer is keep returning null for some reason. I pretty sure, that the Dashboard exists and it has both filters and parameters on it, also the User exists to, and I send the authorization token too. Do you have any idea what might be causing the error? (I got the ItemId from the /api/v2.0/items, the UserId from the api/v2.0/groups/1/users, and the token from the /api/token)
Thanks.
Tamas


AB Arasuraja Balakrishnan Syncfusion Team September 28, 2018 12:31 PM UTC

Hi Bondor, 
 
Thanks for the update. 
 
We will work on the sample with your requirement and update you with in 2 business days. 
 
Also we have checked the GetDashboardParameter API from our end and it will return the proper empty result if no parameter exist for the Dashboards as below, 
 
 
Please make sure you have provided the appropriate input to the API and let us know if the issue still persists. 
 
Thanks, 
Arasuraja B. 



BT Bondor Tamas October 1, 2018 01:14 PM UTC

Hey Arasuraja,

Thanks, for your response.

Yes, I think the parameters are okay: http://take.ms/rjLlV and I have set the Headers too: http://take.ms/I5rkT (access-token is a variable with the current access token for authorization). We have User with Id:1 and the Item ID comes from this: http://take.ms/WuxFi ,  but I'm still getting null. Might this be an issue with our Dashboard Server? do we need to install something on it to make this work?

Thanks,
Tamas B.


SU Suriya Syncfusion Team October 2, 2018 03:19 PM UTC

Hi Bondor,  
 
We could not access the screenshot links that you have shared with us.  
 
We created a below sample to help you with GetDashboardParameters API.   
In the above sample, we will add the sample dashboard configured with parameters, and we retrieve these parameters using GetDashboardParameters API  
Note: If the dashboard is not configured with any parameters, it will show the response like below.  

  
  
If still you are facing the problem, please share the screenshot of response you are getting from the API.  
 
Regards, 
Suriya 



BT Bondor Tamas October 4, 2018 08:45 AM UTC

I'm sorry Suriya, I forgot that those links will expire...
Here they are: 
Parameters: https://monosnap.com/file/G5xzBwZKnic8ixkJSUuPNcJUkzTRX6
Headers: https://monosnap.com/file/WMUMrx4HHYzGzBEEwHaKYT8d4II6nF
GetItems: https://monosnap.com/file/EaHT45KBmZ9E2EVmWI0lpTD8I9XztN


BT Bondor Tamas October 4, 2018 09:57 AM UTC

Hey Suriya,

Thanks for the Demo, my question is, that how should I launch it? It has some hard-coded users/urls, I tried to import one of the Dashboards to run it locally from my Dashboard Designer but I failed, it couldn't connect tot he server. 
I've copied the code from the sample that you provided (only the GetDashboard endpoint), and run it on my server, but the result was still null: https://monosnap.com/file/MounhBkh66C3zc1Q1pMITKsKTr6CGi .

Please can you update the Demo, to include some live dashboard servers instead of a local one? 
Also back to my other question, from comment #6 (I have added the correct links to the screenshots) - as you can see I've tried accessing the endpoint from postman (not C# code) and I still got 'null'. What am I doing wrong? Might the problem be with our server? Or am I handling the parameters/headers incorrectly.

Thanks, Tamas B.


SU Suriya Syncfusion Team October 4, 2018 01:12 PM UTC

Hi Bondor, 

Thank you for sharing the images with additional details. 
 
We are unable to reproduce the reported GetDashboardParameters issue through postman/code behind and Dashboard Designer connecting issues. 

We request you to send log files to validate both the below items, 
  1. Failed to import dashboards from dashboard designer
  2. Null value returned while accessing GetDashboardParameters API.
 
NOTE: Since it is public forum, if you hesitate to share your logs here, could you please create support incident using below link, 

Follow below steps to share us log files: 
 
Designer Logs: 
Please follow the steps in below KB to take log files for Dashboard Designer. 

Server Logs: 
Please follow the below steps to take log files for Dashboard Server Azure App 

  1. Login to Azure portal: https://portal.azure.com.
  2. Select the Syncfusion Dashboard Server App Service.
  3. Stop Dashboard Server Azure App Service and then click on Get publish profile.
                     
  1. Save the <App service name>.PublishSettings file and open it.
  2. The file contains 2 <publishProfile> sections for Web Deploy and FTP.
  3. From the FTP <publishProfile> section copy the following values:
                 publishUrl  
                 userName  
                 userPWD  
                       
  1. Use these credentials in FTP client FileZilla, simply plug these values into the Host, Username, and Password fields as shown here, and click Quickconnect.
                    
  1. Please share the logs from below location “/site/wwwroot/App_Data/Logs” as shown below,
                
Regards, 
Suriya 



BT Bondor Tamas October 4, 2018 02:11 PM UTC

Hi Suriya,

Thank you for the details. I will try to reformulate my request:

We have a dashboard server installed where we have dashboards, some of the dashboards have parameters set. I don't want to upload dashboards like in your previous examples. I just want to retrieve the parameters for the existing dashboard with the API so it would help me a lot if we could have a Postman request to a public dashboard server which returns these parameters.

Is there a public dashboard with parameters (or can you create one) on the https://dashboardsdk.syncfusion.com server and provide a postman call where I can see that the parameters defined for the dashboard are returned.

Thank you.


MM Mahendran M Syncfusion Team October 5, 2018 06:23 PM UTC

Hi Bondor, 

We have modified the samples to get the parameter from the existing dashboard on the dashboard server support site. Please download the sample from the below link, and run the sample without any changes. 

https://www.syncfusion.com/downloads/support/forum/140076/ze/GetDashboardParameters725349208.zip 

It will pull the dashboard parameter from the existing dashboard. Please let us if still need any further help on this. 

Thanks, 
Mahendran Madasami 



BT Bondor Tamas October 9, 2018 09:10 AM UTC

Hey Mahendran,

I downloaded the project you sent, and it was working well with your data. I have tried this project to access my Dashboard Server, however I still got null as an answer. I have created a new ticket, with more details so you can test it properly: https://www.syncfusion.com/support/directtrac/incidents/217160
I also managed to get null with your data with the sample project: I added an un-existing userId (ex.: 48) or an un-existing ItemId. - In my cause I'm pretty sure that the UserId and the DashboardId are both valid, so it might might be an other issue.

You can now close this ticket, thanks for the support


SU Suriya Syncfusion Team October 9, 2018 01:43 PM UTC

 
Thank you for your reply. 
 
Regards, 
Suriya 
  


Loader.
Up arrow icon