How to call external API using Velocity Template Language

870 Views Asked by At

I am working with Velocity Template Language. I want to invoke a rest api to get the response using VTL. How can I call an external rest api to get the data using Velocity Template Language?

1

There are 1 best solutions below

0
On

If you have the Velocity Tools in your context, you can use the JsonTool or the XmlTool (depending on the API return format).

#set($result = $json.fetch('https://your/rest/api')