Today, I wanted to post a little addendum to our earlier post on Groovy and REST. We’ll take a look at how you can further extend your integration capabilities, by adding ODI to your Groovy > REST calls. You might have noticed Groovy on ODI and wondered how you might use it. To access ODI’s native Groovy scripting console, navigate to Tools > Groovy from the Studio.
Just select “New Script” and the console opens up.
Now, let’s see how we can run a simple Groovy command. The following command tells us what version of Groovy is available, from ODI.
1 |
println GroovySystem.version |
Just click on the Execute button and you should get the results as seen below.
Now, let’s see how we can use our HPCM GET call from our last post. Just plop the code from that post into the console and execute it and you should get the right results.
Bonus
Don’t forget, you can add this code to a procedure, so that you can execute your code snippets from a package. Set Groovy as your target technology.
Set the Context and you should be good to go.
Save this off and you can use this procedure within your integrations. You can also add all of the usual ODI API references, variables, error checking etc. to enhance your automation needs.