Sunday, 28 August 2016

Hyperion Planning REST API



In this blog, I would be talking about the Hyperion Planning REST API. Well, very often you come across a tool that is easy to use and solves a business problem with simple and elegance that you really need to appreciate the thought process that went behind designing the tool. Solving something with simplicity is very difficult and all the good algorithms in computer science do just that. Well, for anyone who has worked with PBCS in the recent past, there is small little tool called EPM Automate that basically automates the common administrative tasks in PBCS. And having used this tool, it is quite a handy little tool that solves most of the common administrative tasks in a jiffy. So, there I was the other day, looking up EPM Automate to see how its implemented, when I came upon this blog by John Goodwin regarding Planning REST API (http://john-goodwin.blogspot.in/2015/09/planning-rest-api.html)

So, finally found that the Planning REST API is the building block of the EPM Automate. Now, I am trying to do this on my native installation of EPM that I have which is not a cloud based implementation.

So, the URL I used for testing the REST API on my native installation is of this type: -



As you can see in the above snapshot, it gave me a response of the different versions for the rest api in JSON format.
The entire output is shown below: -
{"items":[{"version":"v1","lifecycle":"deprecated","isLatest":false,"links":[{"rel":"canonical","href":"http://WIN-LD9C40U8DI5:19000/HyperionPlanning/rest/v1"},{"rel":"successor-version","href":"http://WIN-LD9C40U8DI5:19000/HyperionPlanning/rest/11.1.2.3.600"}]},{"version":"v2","lifecycle":"deprecated","isLatest":false,"links":[{"rel":"canonical","href":"http://WIN-LD9C40U8DI5:19000/HyperionPlanning/rest/11.1.2.3.600"},{"rel":"predecessor-version","href":"http://WIN-LD9C40U8DI5:19000/HyperionPlanning/rest/v1"},{"rel":"successor-version","href":"http://WIN-LD9C40U8DI5:19000/HyperionPlanning/rest/11.1.2.4"}]},{"version":"v3","lifecycle":"active","isLatest":true,"links":[{"rel":"canonical","href":"http://WIN-LD9C40U8DI5:19000/HyperionPlanning/rest/11.1.2.4"},{"rel":"predecessor-version","href":"http://WIN-LD9C40U8DI5:19000/HyperionPlanning/rest/11.1.2.3.600"}]}],"links":[{"rel":"self","href":"http://WIN-LD9C40U8DI5:19000/HyperionPlanning/rest/"},{"rel":"canonical","href":"http://WIN-LD9C40U8DI5:19000/HyperionPlanning/rest/"},{"rel":"current","href":"http://WIN-LD9C40U8DI5:19000/HyperionPlanning/rest/11.1.2.4"}]}


If you check the entry for 11.1.2.4, you will see that this is the active one and the latest one as well… So basically any query to the application will now take the form of http://localhost:19000/HyperionPlanning/rest/11.1.2.4/.....

I now tried to see if I can list the applications in the Planning environment but I got an error as shown in the below snapshot: -
 
So I got an IllegalArgumentException saying that cssUser is NULL which makes sense since I am not supplying any user name and password… 

Now, in order to control these basic things like user name and password, you can install the RESTClient addon in Mozilla, that basically acts as an interpreter for all your REST API requests… I installed it and below snapshots show me setting the user name and password in the Basic Authentication tab…





Once I entered and saved the credentials, the same query for listing out the applications works perfectly as shown in the below snapshot. Note that I am interested in getting all he information that is exchanged via http so this includes response headers and stuff…

The response header is as shown in the below snapshot. Observe the status message (200 OK) and the time stamp info… Status messages are quite useful for debugging and checking connection issues…




Response body in raw format is as shown below: -


Response body with JSON tags formatted is as shown below… 



Now, the best part…The real motivation for trying this was to see if I could design a Java program that would interact with the REST api using the java.net package…

Well, good thing is that I managed to get the first set of output using Java…Below snapshots of connecting to the server using Java and the sample output…





This output is similar to the one from the RESTCient addon… Will try to implement a full-fledged solution using the networking package in Java… More sleepless nights in sight…Will keep you posted…
 

2 comments: