0 Replies Latest reply: May 15, 2018 5:15 AM by Alexandre Pinheiro RSS

    How do i Use Qlik Nprinting API to generate a report on a Mashup

    Alexandre Pinheiro

      Hello everyone,

       

      I've been trying to create a logic that allows me to generate a Nprinting report using the Qlik Nprinting API by clicking a button on my mashup (something similar to the extension that exists but that works on a mashup framework):

      I've already checked the option of on demand request on the nprinting server.

       

      teste1.PNG

       

      Below you'll find my Javascript code for this button. The login works fine and the connection is made so i assume there is some wrong syntax:

      $scope.Teste = function(){
      
                 var URL = 'https://SERVERNAME/'+ 'api/v1/login/ntlm'
      return $.ajax({
      url: URL,
      method: 'GET',
      xhrFields: {
      withCredentials: true
      }
      }).done(function(data) {
                     $.ajax({
                              type: "POST",
                              url: 'https://SERVERNAME/api/v1/ondemand/requests/',
                              xhrFields: {
                                  withCredentials: true
                              },
                              contentType: 'application/json',
                              data: {
                              type: 'report',
                              config: {
                                  reportId: '51eed116-78df-4cee-9270-1a17bf60a005',
                                  outputFormat: 'xls'
                              }
                              }
      
             }).done(function(data) {
      
                          console.log(data);
                          });
      });
      };
      

       

      Right now i'm just trying to get a static report that exists on the server but i'm getting error 400: Bad request.

       

      Thank you