Newbie: Help with Orders example
-
Ok so in the Orders script it says "the report parameter country can be send from the client API request". How do i do this? I tried passing a query string in URL "http://localhost:5488/templates/HJH11D83ce?country='Italy'", but just ignored and showed the "default" France. Thanks for the assist.
-
Check the API documentation. You need to do a REST POST call and pass the country in the
data
property.
https://jsreport.net/learn/api
-
So far we don't pass the query parameter of the GET request, you would need to do it through a custom jsreport extension if you really need it. However usually you define a template in studio, do a POST to the service with provided parameter from your app and store the output stream.
-
Thanks! Sorry new to all of this...kind of just hacking along. If I may ask 1 more newbie question:
I got the REST POST to work(I guess)
$.ajax({
url:"http://localhost:5488/templates/HJH11D83ce",
contentType: 'application/json',
success: function(response) {console.log(response); }
});
So how do I show the pdf response?
-
What you show is likely still GET. The POST should go to url
/api/report
.
You are probably interested in the jsreport browsers sdk. This helps you with making the API call and showing the pdf.See docs here
https://jsreport.net/learn/browser-client