Jump to content

url to go straight to a JS report?


arianhojat

Recommended Posts

I was going to embed a report in an iframe, but wasnt sure what url to go straight to a report once you log in, and also how to pass in parameters through the url.

Something kinda like:

url="/jasperserver/reports/SalesbyMonth?TextInput=999&ListInput=3&DateInput=&QueryInput=&_eventId=setInputValues&decorate=no"

 

Also any help on how I can pass in a username/password automatically so JS doesn't need to ask user to log into JS in the iframe?

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

k I figured one aspect: how to get to a report with just url (have to enter username and password be4hand though) and do parameters in url.

 

here is a url:

http://OurIntranetServer:8080/jasperserver/flow.html?_flowId=viewReportFlow&curlnk=2&_eventId_selectReport=&reportUnit=%2Freports%2Fsamples%2FEmployees&currentPage=&putAnyExtraParamsHere=

 

_flowId=viewReportFlow : means view the report

 

curlnk=2 : means highlight the 2nd link in menu which is 'View'

 

_eventId_selectReport= : i dont think is needed if just viewing report. not sure what it does. as reportUnit param gets u to the correct report.

 

reportUnit=/path/to/report : can figure out by going to repository

 

decorate=no : i just mention this cause sometimes in my POST headers it supplies this argument, but if u supply it via logging in, it makes menu and other things disapear so you just have the report, But in SaleByMonth report, it seems to need some extra javascript (for calendar popup in the Options popup for example) that isnt supplied when extra stuff is gone. So I dont include this option currently.

 

 

At the end of the url, i put a var called putAnyExtraParamsHere presenting any options/params to pass in. You can figure out by going looking at POST headers for example with LiveHttpHeaders in Firefox when posting parameter filter search in JasperServer and add those parameters to url.

 

If anyone knows how to make this work without user entering username and password be4hand? I am going to try cURL POST with username/password params in a POST in a php script simply to see if this can work. Will keep updated.

 

Post edited by: arianhojat, at: 2007/09/20 15:57

Post edited by: arianhojat, at: 2007/09/20 16:09

Link to comment
Share on other sites

close but no cigar, when goto

http://apacheServer/curlLogin.php, doesnt login,

, shows me the login screen at that url and when enter username/password there, says 'The requested URL /j_acegi_security_check was not found on this server.'

 

 

Script so far below:

 

$url = 'http://ourIntranetServer:8080/jasperserver/flow.html?_flowId=viewReportFlow&curlnk=2&_eventId_selectReport=&reportUnit=%2Freports%2Fsamples%2FEmployees&currentPage=';

 

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $url);

 

curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");

curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// Follow any Location headers

curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);// dont echo output

 

 

$cookie = "jasperCookie.txt";

curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookie);

curl_setopt ($ch, CURLOPT_COOKIEFILE, $cookie);

 

 

$postfields = array();

$postfields['j_username'] = urlencode('jasperadmin');

$postfields['j_password'] = urlencode('thepassword');

$postfields['btnsubmit'] = urlencode('Login');

$postfields['userLocale'] = urlencode('en_US');

$postfields['userTimezone'] = urlencode('GMT-05%3A00');

 

curl_setopt($ch, CURLOPT_POST, 1);// Alert cURL to the fact that we're doing a POST, and pass the associative array for POSTing.

curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);

 

$output = curl_exec($ch);

 

curl_close($ch);

print $output;

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...