Jump to content
We've recently updated our Privacy Statement, available here ×
  • Rest operation with Jasper report server :


    Jivan Phadtare
    • Features: Web Services Product: JasperReports® Server

     

    In order to export the reports from jasperserver via a web service we need an API tool to connect to the Jasper server. We can use the ‘Postman’ API or freely available ‘Advanced rest client’ API.

     

    Link to download Postman API : https://www.postman.com/downloads/

     

    Link to download Advanced rest client API : https://install.advancedrestclient.com/install

     

    Once these API tools are installed, then try to make a connection to JRS with these tools. Make sure that JasperReport server is up and running.

     

    With get method from postman API try to send below request to server, if connection is successful then in response to below request server it return 200 OK code response with server information.

     

    http://localhost:8080/jasperserver-pro/rest_v2/serverInfo


     

    eRl8SIri6ocQf3hqdOPOZoA7Wasmn9MrC-bQG6vB4RYKXwnrv7n7BpseQaAyVf0nbUKC2zJd3K5E3L-J0eJYjXrC1m4X93pVLkag0u1yZFqY_OTq0ZDcjtiWvA3J14LVz6RxftUJ



     

    • Fetch the report using V2 report service.

     

    Make a sample report available in the Jasper server to fetch it from the postman.

    With the below v2/reports service URL, try to fetch the report from JRS.

     

    Method : get

    URL : http://localhost:8080/jasperserver-pro/rest_v2/reports/public/userrpt_15032022.pdf

     

    –In the above URL use your reportname file which you want to access through API.

     

    Report will be visible like below. You can export it from the postman API tool.

     

    zPAQlx1oTvDtqmw5QIIGxXmB5nE2yMKrRp-dB6vv6F4XYjd63_oOUk5rgIfqMddIpICcunSjr5E2FYG5HQjKw9ZaM-tLvIjdD1zvBHhezMTuxcDOoYR3elaZRbY2vdw6TU1bzrZE








     

    Steps to export Report using V2/export service

     

    Here with V2/export we need to use the post method and use the URL below.


     

    http://localhost:8080/jasperserver-pro/rest_v2/export/

     

    It will ask for JRS credentials to connect to the server. Select basic authentication and put the JRS credentials.

     

    Also under the body tab you need to provide a parameter value, in the below screenshot “everything” is provided. You can refer to the web-service cookbook from community jaspersoft to check for further parameter values.

     

    So this will generate export_id, highlighted in blue in screenshot.

     

    h6IwvEEU1KBLcrbcQOxEvaaZK6N_yYM9SZnFz2Z5KnhXLcYmBHX2lVPaNvGNikcFqZxoGoksWDi1nRB4nKbuLWqYhxwOctKpMCX-b5JTm_hIviAkZ7WyWSeaaU5VLmP8Q6-CR4qV


     

    To check the above export status use the URL below with export_id.

     

    Export_ID : deef7459-5f92-49f8-9571-684582e27f42

    URL : 

    http://localhost:8080/jasperserver-pro/rest_v2/export/deef7459-5f92-49f8-9571-684582e27f42/state

    LCBUjNMgGHnt3HLDarBweIrN-gNJgxyw3eSc_WwdLlX0KlVuVLSU5tG2mb2tvPAaIbCoztqsb2g1nxUk6xwzAk17kkT6kNqq-zM3c-CkS8Mu5st46PxepTkUFGyhGoP_PIOWWaeK

     

    It shows export status as successful in response.

     

    To download the report :

     

    Use the URL below with export_id to download the report.

     

    Method : get

    URL : http://localhost:8080/jasperserver-pro/rest_v2/export/deef7459-5f92-49f8-9571-684582e27f42/userrpt_15032022.pdf






     

    rest_jrs_-_google_docs.pdf


    User Feedback

    Recommended Comments

    There are no comments to display.



    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...