Pages

Monday, September 11, 2017

Finally REST(REST API) on Oracle PBCS!!!

This was a lying in my draft for a quite long time after my webinar on this topic, finally publishing it :-)  have fun.

The complete documentation for the REST API for Oracle EPM Cloud is here

Straight from document:

REST describes any simple interface that transmits data over a standardized interface (such as HTTP) without an additional messaging layer, such as SOAP. REST provides a set of design rules for creating stateless services that are viewed as resources, or sources of specific information, and can be identified by their unique URIs. RESTful web services are services that are built according to REST principles and, as such, are designed to work well on the web. Typically, RESTful web services are built on the HTTP protocol and implement operations that map to the common HTTP methods, such as GET, POST, PUT, and DELETE to retrieve, create, update, and delete resources, respectively. 

REST API Methods

You can create, view, update, or delete Oracle Enterprise Performance Management
Cloud resources using standard HTTP method requests, as shown below
Method
Description
GET
Retrieve information about the REST API resource
POST
Create a REST API resource
PUT
Update a REST API resource
DELETE
Delete a REST API resource or related component

Current REST API Version

Covering only majorly used components
REST Resource REST API version Getting REST API Versions
     Planning
v3
/HyperionPlanning/rest/ 
     Migration
11.1.2.3.600
/interop/rest/ 
Data Management
V1
/aif/rest/

There are multiple REST API clients available for free, you can pick as per your choice.

Using the REST API client invoking the Planning REST resource (/HyperionPlanning/rest/ )  will provide the latest and active API version.

Invoking the Migration REST resource (/interop/rest/ )  will provide the latest and active API version.

Invoking the Data Management REST resource (/aif/rest/ )  will provide the latest and active API version.
  • These REST APIs support basic authentication (name and password) in the format identitydomain.username for this release. 
  • All HTTP requests to the Oracle Enterprise Performance Management Cloud REST API require authentication. 
  • Every HTTP request to EPM Cloud should supply HTTP Basic Authentication credentials through the Authorization header.
User Id and password needs to be specified for accessing all of the resource as specified below,

The REST APIs allow service administrators to perform the tasks in the EPM Automate Utility through REST APIs instead of using a command line. You must be a service administrator to perform tasks using the REST APIs.

Lets see how to access REST API via the GROOVY ya the complete automation.
About Groovy:
Apache Groovy is an object-oriented programming language for the Java platform. It is a dynamic language with features similar to those of Python, Ruby, Perl, and Smalltalk. It can be used as a scripting language for the Java Platform, is dynamically compiled to Java virtual machine (JVM) bytecode, and interoperates with other Java code and libraries. Groovy uses a Java-like curly-bracket syntax. 

Planning REST APIs


Use the Oracle Hyperion Planning REST APIs to get the REST API version, manage
and execute jobs, and work with members, applications, planning units, user
preferences, data slices, and substitution variables.

I have built a simple program that will list the details about the PBCS application that is already created.

My Properties File:

Importing the needed package and passing the needed information for the execution, in this example i am reading the values from a properties file.


Added the Helper Commands taken from the document.


Function to get the application details


Output of the Program:



Will post the rest of the groovy program for calling the /HyperionPlanning/rest/ in the upcoming series.

Happy resting with REST API....

7 comments:

  1. Good document to start with the REST API for PBCS. I love to do with Python. Really appreciate your effort on this blog.

    ReplyDelete
  2. Any word on the on prem documentation? I have gotten a handful of these API's working (couldn't have done it with out your blog) and they have been great, especially importing and exporting JSON paylaods, but the cloud documentation of the Execute Job request payload does not work for on prem and I haven't been able to modify to work.

    ReplyDelete
  3. Glad my post helped you.I did covered regarding jobs in other post https://onlyhyperion.blogspot.in/2017/10/planning-rest-api-oracle-pbcs.html
    but that is for PBCS. Can you post the code your are using and the issue, i will try to have a look.

    ReplyDelete
    Replies
    1. Hey thanks for taking the time. I am using 11.1.2.4 on prem. The URL I am using is /HyperionPlanning/rest/11.1.2.4/applications/MyApplication/jobs. I read that that 11.1.2.4 takes form urlencoded payload so I have been passing

      JobType="Rules"&JobName="CALCALL"

      I have tried JSON objects as well

      {“JobType”:”JobType”,”jobName”:”JobName”}

      no matter what I pass, including total garbage I get

      {
      "descriptiveStatus": "Error",
      "jobId": -1,
      "details": "Unable to find the job because the job name or type is missing. Try again with a valid job name and type.",
      "status": 4,
      "type": "HP",
      "links": null
      }

      Delete
    2. Try jobType="Rules"&jobName="CALCALL" where both occurences of j are lowercase. Worked with me as long as the rules does not have an RTP

      Delete
    3. Thanks for the reply but I got it working awhile ago. Too bad the about the RTPs, seems like a bug that is hopefully worked out

      Delete
  4. i am working to synch two env for dR, is it possible using only rest API

    ReplyDelete