Category: REST API

What’s New in Oracle Policy Automation 18C?

What’s New in Oracle Policy Automation 18C?

What’s New in Oracle Policy Automation 18C?

It’s August and it must be time for another Oracle Policy Automation release! The team at Oracle have been beavering away and have unleashed lots of really cool new features in 18C. Here is a quick run-down of the things that will bring a smile, hopefully, to your face!

New REST API Functionality

Now we can really automate the processes that are involved in setting up Oracle Policy Automation. In addition to the existing REST interfaces for deployments and user management, there are now three new endpoints available in 18C:

  • Connections REST API – Creation and management of connections for any Policy Automation Hub. Programmatically insert Connection information like URLs, service information and so on
  • CORS Whitelist REST API – manage your whitelist for Cross Origin Scripting
  • SSL Certificates REST API –  if you use a custom root certificate for a Web Service Connection, now you can manage that with REST as well

New Build Feature

Using the OPMBuild command-line tool you can now  build deployment snapshots.

Obtain the Current Locale

Amusingly enough only a few days ago we were discussing language and locale on this site, and now we have a new function we can use in our Oracle Policy Automation rules to facilitate just that! The CurrentLocale() function returns strings like “en-GB”. When the user changes language in a multi-lingual interview, this value is updated too. Of course this opens up all sorts of interesting possibilities like locale sensitive help, URL links, or redirects at the end of an interview. Cool!

OPA 12 - 18C Locale Function

And of course once the information is available, you can display it in your Interview or otherwise use it as you see fit.

OPA 12 - 18C CurrentLocale in InterviewOther enhancements

Amongst the other enhancements are valuable new features in :

  • More Data Entry Options for X-to-One relationships – Yay!
  • PDF Form Fields (allowing TTF fonts)
  • Deployment as a Web Service now offering two choices : Assess / Answer  or Interview Service
  • In multi-input date controls, the ability to specify the Year Range and Second Increment

Now, if your chosen date entry style is the multi-input version, you can customize easily the date range:

OPA 12 - 18C Multi Input Date Options

In the next few weeks we will be investigating some of these in more detail. Good Job Oracle Policy Automation!

Deployment REST API : Uploading Zip Files #1

Deployment REST API : Uploading Zip Files

Following on from a post in the not too distant past, where we looked sideways at the Deployment REST API and the ability to download the Zip File of a deployment snapshot programatically, this new post answers a request from one of our readers regarding the “other side of the coin” ; specifically how to take a Zip File that needs to be uploaded into an Oracle Policy Automation Hub, and get the file to load up into the Deployments, using code. I must thank the commenter on the previous article for sharing his question, since it is one that comes up quite a lot and this is a good opportunity to hopefully show how you might do it.

The starting point of the process is that you have previously downloaded a snapshot file from a Deployments page of your Hub in environment A, and you now want to copy it across to environment B.

With your Zip File in hand, what can you do to automate this process? Of course, you turn your attention to the REST API and the deployment REST API in particular. Find the page that matches your version and let’s have a look.

    "name": "Example",
    "description": "Description of Example Project",
    "compatibilityMode": "latest",
        "Default Collection"
                "description": "The initial version",
                "activeVersionFlag": true,
                    "base64": "...base64 value..."

How to get a class out of that? If only I could find a way to turn that into something easy to use in Visual Studio, I could create my own…wait a minute! Enter JSONUtils – the perfect site for converting JSON into C# or Visual Basic Classes.

OPA Hub - Deployment REST API Generate Class

How easy is that?

  1. Choose your language
  2. Give your new Class a name
  3. Paste the sample from the Oracle REST API documentation
  4. Press this button
  5. There’s your class, ready to use in your Visual Studio project.

Armed with this, we are ready to continue our research. We also need to be able to POST our request to the Oracle Policy Automation Hub. Thankfully somebody else has already asked about POSTing JSON to a specific URL millions of times, and there is a good starter function on Stack Exchange. At the bottom of that question is a great example.

Checklist – REST API Deployment

We can step back a moment and review a checklist

  1. We have Class to model our request
  2. We have a function to use HTTPWebRequest send things to the Oracle Policy Automation Hub
  3. We have an integration user and password, and the url of the Oracle Policy Automation Hub

So what else do we need? We need to be able to turn the Zip File into an encoded string as per the example given on the Oracle Policy Automation website : something like this:


Public Function ConvertFileToBase64(ByVal fileName As String) As String
        Return Convert.ToBase64String(System.IO.File.ReadAllBytes(fileName))
    End Function

In the second part of this post, we will put it all together and see the result!

What’s New in Oracle Policy Automation 18A #2

What’s New in Oracle Policy Automation 18A #2

The second post in this series about What’s New in Oracle Policy Automation 18A covers the new administrative features relating to the REST API. As many readers will know, the latest versions of the product all provide a variety of interfaces that can be manipulated either using a traditional programming language (for example, in an earlier post we looked at using Microsoft Visual Studio and the REST API to review information about users, deployments and even to automate the download of a deployment ZIP file as a proof of concept), or other tools as explained below.

It is possible to use more modern tools such as curl command line tool and library to make calls and receive the JSON output. As a last resort or simply for test purposes one can always use SOAP UI. Although (naturally) we think of SOAP UI as a SOAP testing tool, it is equally at home testing REST endpoints.

What's New in Oracle Policy Automation 18A REST Project

The REST API requires the use of OAuth authentication, so you will need to set up an authentication profile and leverage it to acquire an access token. Once the token is acquired and as long as it has not expired, many calls can be made to the REST API endpoints for example for users, deployments but even (if licensed) the batch engine.

What's New in Oracle Policy Automation 18A OAuth

In the above example, the token is being accessed through Client Grant, using an integration user called integration_example. It assumes of course that this user exists on the Oracle Policy Automation Hub and has API access.

As we are discussing  What’s New in Oracle Policy Automation 18A #2, to quote from the official documentation :

Policy Automation Hub Administrators can now automate the lifecycle of end-to-end integration credentials. The OPA Hub REST API supports the management (create, view, update and delete operations) of three user types: regular users, local API client users and IDCS API client users.

As per the explanation above, the /users endpoint now supports not only normal, and API users but also an Identity Cloud Service user. In the example below, an authenticated call is made to the /users endpoint, and in the latest version this supports all the verbs you will need (GET,PUT, POST,PATCH,DELETE) to fully automate the users collection in your environment.

What's New in Oracle Policy Automation 18A Users Endpoint

Whats New in Oracle Policy Automation 18A #1

Whats New in Oracle Policy Automation 18A #1

Whats New in Oracle Policy Automation 18A #1

And so the latest and greatest version of Oracle Policy Automation has just hit the shelves, I’m of course talking about version 18A which became available for download from the Oracle Policy Automation Downloads page on the Oracle Technology Network pages. The list of what’s new is quite short this time, although we can imagine that lots of things have been going on behind the scenes given some of the early access info that has been filtering out on the official Oracle Policy Automation Blog these last few weeks. So, on with Whats New in Oracle Policy Automation 18A #1!

Whats New in Oracle Policy Automation 18A #1

Automatically Retrieve List Values from Rules

The biggest addition to the Oracle Policy Modelling experience in this new version is the concept of dynamically (or almost) retrieval of lists of values from rules. I’ll give you an example that you might be familiar with. You have written rules that deal with an attribute, of type Text, and you have referenced it several times with different values, perhaps as a condition to some conclusion. And now you want to add it to an interview. At some point you will find yourself copying and pasting the values in your Word document into a Value List or a plain old List of values in the Interview Screen.

Well, not any more. The video in the next paragraph shows off the new functionality, whereby the modeler can retrieve the values at the click of a button and add them to a screen, or of course use the existing functionality to turn them into a Value List. The video goes on to demonstrate what happens when you go back and edit the rules in the Word document, and what happens when you change the Control type – for example from Drop Down to Fixed List and so on.

The example uses a fictitious restaurant deciding the correct level of spices to be added to their sauce, depending on the customer selection.


That concludes our post Whats New in Oracle Policy Automation 18A #1, in the next post we will look at some improvements to the REST API (which we looked at in earlier posts) to enhance user lifecycle management.

What’s New in Oracle Policy Automation August 2017 #2

What’s New in Oracle Policy Automation August 2017 #2 (OPA REST API)

I’ll be entirely honest and say that this post has more to do with finding a good method to describe practical uses for the REST API that would be both interesting and entertaining, than it has with specifically focusing on what is new in Oracle Policy Automation August 2017. But since the OPA REST API is really coming into it’s own in the latest versions, it seems appropriate to file this under the heading of What’s New.

So I fired up Microsoft Visual Studio and decided to challenge myself to provide some code and demonstration that shows how to use the OPA REST API in Visual Basic. I decided to focus on the Deployment API, but wanted to get there in a set of logical steps : basic use, getting structured data out, authenticating your user and finally getting a Zip file to download.

For the Hub REST API, you need to create an integration user. For deployments, the caller needs the Deploy Admin role for the collections they want to access.

I’ll repeat what I said in the video; I’m no programming professional – although I can code my way through most things – and this is a late night experimental plaything, so don’t expect much in the way of clean structure. With that proviso, here are the four challenges.

OPA REST API – Deployment API First Steps

  1. Make a simple call to the API for example in order to retrieve the version information, and see if we can dump the output somewhere

This part is all about the mechanism to actually call the the REST API. The output is just a nice thing to prove it works.

OPA REST API - Get basic about information

From the above snippet, you can see the basic principle : create a WebRequest and build the URL, before asking for the response. The response can be read from the responseStream, and converted into a string before being displayed in a text box on a form.


OPA REST API – Deployment API More Data

So the next step in the learning curve of OPA REST API is to grab more content, and then format it in some way. We are going to get the list of endpoints and the corresponding URLs. The structure is hierarchical, an array of items, and each item has an array of links. For this, we will use a couple of classes to help us define two concepts : the items in the response and the links which are children of the items.

OPA REST API - Get Items and Links

In the above example, the same technique is used to make the request, but the response is deserialized into items and then each item is inspected for links. Since each item has three links and the third one is the link I want to display, I grab that one.

OPA REST API – Deployment Get Authenticated

In the next example, I want to show how to obtain the OAuth2 authentication access token. Most people will not have their Oracle Policy Automation Hub with anonymous access, so this is a very important step.

OPA REST API - Get Authentication

In the example above, the token is parsed out of the response using a different method, grabbing the element through the key to identify it. In this case the response is simple and is not an array.

OPA REST API – Deployment API Download a Snapshot as a Zip

Finally, now that I was able to do all of that, I wanted to make some magic happen. If I can authenticate, let’s go get a deployment as a Zip file and programatically download it.

OPA REST API - Get Zip File

In this final example, the request accepts “application/zip” and the response is grabbed as a memory stream and sent to a file. The folder has to exist but the ZIP file will be created there.

OPA REST API – Deployment API Conclusion

Although this started out a little exercise, I very quickly became a big fan of the OPA REST API – the prospect of being able to undertake so many different tasks (remember that there is a batch assessment API as well as user API) and/ or to programmatically instance them opens up new and powerful avenues for anyone looking to strengthen their DevOps processes around Oracle Policy Automation.

The video below is the code in action, and the result. Anyone who is interested in getting a copy of the code, just leave a comment. No warranty or fitness for purpose implied, but I hope the community will take it as it is intended : as a learning objective about the OPA REST API.

Until next time on the OPA Hub Website, have a great day!

Logo by Southpaw Projects LLC