We can invoke Watson API from IBM i using DB2’s SQL function Httpgetclob.
Httpgetclob retrieves a text-based resource from the specified URL through an Http Get Request.Httpgetclob returns the resource as CLOB(5M) data.
Example : Calling WATSON language translate Api to convert english to french using httpgetclob.
Select Char(Systools.httpgetclob(‘https://watson-api-explorer.mybluemix.net/language-translator/api/v2/translate?model_id=en-fr&text=good+night’, ‘ ‘), 256)
From
Sysibm/Sysdummy1
Result : This query would return Bonne nuit