3 Replies Latest reply on Nov 30, 2019 1:08 PM by Andre Kirsten

    How to configure a token in a Rest Web Service Consumer ?

    Falilou WAIDI New Member

      Hi,

       

      I have an application that is using a Rest web consumer transformation.

      Before calling the base URL with the Rest web service, I generate a token that will be used for authentication.

      How do you configure the token in Informatica developer ?

      Do you create two Rest web consumer transformation ? (one for token and second for the call)

      or you can define the token when calling the Rest service ?

       

      Thanks,

      Falilou

        • 1. Re: How to configure a token in a Rest Web Service Consumer ?
          Andre Kirsten Guru

          Hi,

           

          If it is a short-lived token (e.g. valid for a couple of minutes / hours), then you should make 2 REST WSC calls.

           

          If it is a long-lived one - e.g. API key (that practically never changes) then you can add them to the header for the REST WSC directly.

           

          Kind regards,
          Andre.

          • 2. Re: How to configure a token in a Rest Web Service Consumer ?
            Falilou WAIDI New Member

            Hi Andre,

            Thanks for the precision.

             

            The token will be valid for 2 hours.

            So I understood that I have to create 2 WSC calls.

            The first WSC is for the token. It will use the parameters "id,secret and type" and  return the "authorization id"  that I will  pass to the second WSC to get the output.

             

            But my requirement is to run it multiple time ( around 12.000 calls with differents parameters ). So can you help regarding the following questions ? :

            1. How to pass parameters to the token WSC ?

            2. How to pass the the "authorization id" to the second WSC within the same mapping ?

            3. How to do when the token has expired and no longer valid during the calls ?

             

            Thanks,

            Falilou

            • 3. Re: How to configure a token in a Rest Web Service Consumer ?
              Andre Kirsten Guru

              Hi Falilou

               

              the 2 hour lifetime might become a problem if you cannot make all the calls in that time.

               

              There is no way to "loop" inside a mapping itself.

               

              Imho, the most convenient option would be to move the authentication and actual call logic into a java transformation.

               

              There you can check for the validity of the token and to a "re-auth" (however that is provisioned by the ReST API) before proceeding with sending the requests to the endpoint.

               

              You would need to code your own client to make the calls and process the responses though.

               

              Kind regards,

               

              Andre.