'Talend: How can I set global variable into tREST HTTP Headers?

I run a job to refresh token to get new access token every time the scheduled job executed. Then, the json response of the new access token is set as global variable.

Key Value
"myKey" "access_token"

Question is, how can I call the global variable to set as value for Authorization for next API endpoint call?

tREST Job

It is Zoho provided API, it needs Authorization with "Zoho-oauthtoken -access_token-". So I need it to concate with global variable that I set before. Is the calling expression is right?



Solution 1:[1]

In the "value" field , call the global variable with syntax : "Zoho-oauthtoken "+((String)globalMap.get("access_token"))

globalMap is an object representing a key/value table, key being a string, value being an object. To get the value linked to a key , you need to cast the 'object' returned by the 'get' method.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Corentin