Jump to content
We've recently updated our Privacy Statement, available here ×

A3an

Members
  • Posts

    11
  • Joined

  • Last visited

Community Answers

  1. A3an's post in How to pass access token in a request from Jasper report server to JSON data API after sending a login request was marked as the answer   
    Hi jamshaidiqbal120
    I had to figure this out like a month ago and this took me days to set up correctly....
    You need 2 data adapters. The first one is the POST request to get the token, the second one is the GET request where you have to put the token as http header.
    So once you've set up this correctly, you wil be able to use the token in the GET request. I assume this token is only valid for about 15 minutes.

    The POST request:
    Content-Type is very important to add because certain API applications return no result if this is missing.


    If this works well and you can show the access token on your report we can proceed with the GET Request.
    The URL Parameters speaks for themselfs. The http headers here below:


    I don't know the kind of token you have to use but mine was a bearer token.
    You can also use Postman to simulate this. Hopefully you will get a result. (POST and GET)

    Now comes the tricky part...
    The problem with Bearer token is that you only get a token without Bearer in front of it. So you must add "Bearer "+ token as parameter => Note the whitespace in "Bearer "
    So you create a parameter. Give it a name: token and the value is the token you get from the POST Request.

    To use the second data adapter to make the GET call, I've used a list element. This list element is the datasource of the GET request.
    I had tried a sub-report but no luck.

    I can provide you a working example but the report is on another laptop I don't have with me right now.

    Let me know if you've got it to work.

    Greets A3an
×
×
  • Create New...