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