Dayalan Punniyamoorthy Blog

Saturday, August 27, 2022

Invoking REST API via Groovy program outside of EPM Cloud – Authentication to EPM Cloud

In this blog, we will see how to invoke the Oracle EPM REST API endpoints outside of Oracle EPM (as a standalone program accessing the REST API endpoints from any machine where the Groovy program can be executed). We all knew we can call Oracle EPM REST API endpoints from the Calculation Manager Business rules as Groovy rules but this is entirely different from that.

 

There is a sample program that is available in the Oracle EPM docs, but it has hardcoded the password in the program. There were multiple requests during my interaction with other presenters/consultants in KSCOPE 22  where many were asking for either reading the Oracle EPM Authentication Password from a file outside or using the Encoding/Decoding the Password during my session around REST API & Groovy.

 

In this post, (and the next one) I will cover 2 ways to use the password for authenticating With Oracle EPM.

1.   The Groovy Program will Read the password from a file that is stored outside of the Groovy Program

2.   The Groovy Program will use the encoded password using a Secret Key by decoding it.

a.   In addition, there will be a bonus program to Encode the Oracle EPM authenticating Password using a Secret Key.

 

  1. The Groovy Program will Read the password from a file that is stored outside of the Groovy Program

The complete program code can be found here.

 

 

PBCSDetails.properties file is as follows



Reading the Properties file and getting the user ID, Password, and other details from the properties file. 


You can use this method to manage the User Id, Password, and other commonly used parameters in one single file and call them in all the different programs as needed.


 Creating the authentication token by concatenating the username and password and passing that to the basicAuth that is used for the authentication.

 


Creating a connection to the EPM Cloud in line 90 and passing the Authentication Token created above in line 97.


Getting the response and closing the connection once needed action is performed on the line the last couple of lines of the code.



Running the Refresh Database on the Cloud after successful authentication by creating a RunRefreshDB class and passing the needed REST API endpoints on line 139 and passing the needed payload on 148 the Refresh Database is executed on the EPM Cloud.

 

 In the next follow-up post, I will post how to encode the password and use the encoded password in your Oracle EPM REST API + Groovy program. 

Hope this one is useful to all, happy times with Oracle EPM Cloud!!!


 

 

No comments:

Post a Comment