REST API - How to pass parameters to a webreport using rest api call

Dear Experts,

                    Using REST API we can call webreports using url - /api/v1/webreport and in body we have to pass webreport nickname to execute the report .  i want to know how to pass input parameters to the webreport  when making a rest api call. please provide a example to understand . 

Thank you .

Comments

  • Just did this today.  In my Java code I have something like this:

    String url = getAPIURL(1).concat(String.format("nodes/%d/output?format=webreport", rptID));
                if (!params.isEmpty()) {
                    debug("Adding parameters");
                    //url.concat("?");
                    //boolean isFirst = true;
                    Enumeration<String> keys = params.keys();
                    while (keys.hasMoreElements()) {
                        
                        String key = keys.nextElement();
                        String urlParam = String.format("&%s=%s", key, params.get(key));
                        debug("Adding key " + key);
                        url = url.concat(urlParam);
                    }
                }
                debug("Reporting url = " + url);

    which ultimately generates a URL like this:

    cs.exe/api/v1/nodes/[rptID]/output?format=[webreport|json]&inputlabel1=some%20value&inputLabel2=Some%20other%20value

    Depending on your Web Report you may have more luck with format=webreports or format=json

    If you do format=webreports, it just returns your webreport results as a string. This is useful if your web report already outputs JSON. If you use format=json, you will get back a single JSON object of the form {{"data" : {"one big ginormous string which is your WR data"}

    Once again, YMMV

    -Hugh

  • Is there any way to call API from WebReport?

  • Dear Garg Ravi,

    check the documentation.

    Click on CS help and navigate as below. you can call any thrid party URL here and integrate it the webreports.

    Help->Reports->Detailed WebReports Examples->AJAX Examples

  • Hi @Meerasaaheb_Mohmmad , AJAX call we cannot pass certficate and ket right, i am having this issue, do you have any idea.