Dayalan Punniyamoorthy Blog

Monday, February 26, 2018

Explore User Reports & Daily Maint REST API - Oracle PBCS with Groovy flavor !!!

In continuation of other series about REST API on Planning & Migration in this post let’s explore the REST APIs for Provision Reports,User Audit reports and the Daily Maintenance Window Time. 

1.REST API for running Provision report on Oracle PBCS\EPBCS

Straight from the document:
Generates a provisioning report of users in the system and writes the report to the filename provided. This is an asynchronous job and uses the job status URI to determine if the operation is complete.

You can manually generate a Provision Report from Oracle PBCS instance
 Navigate -> Tools

Under Provision Reports
You could find all the users with their roles and you can export that to a .csv file

Resource to access the Provision Report is:
POST /interop/rest/{api_version}/reports?q=type=provisionreport,fileName=provreport.csv}
api version is v1

Now we will call the REST API from the Groovy program (not covering the complete program since its already covered in the earlier posts)

Declaring the api version & file name for export
Function to Export the Provision Report
Function to Export, Download and Delete the Provision report from the PBCS Instance (download and delete functions are explained under Migration)
Output of the Groovy Program
Export of the Provision Report run by the program shown below,

2.REST API for running User Audit report on Oracle PBCS\EPBCS

User Audit Reports can be accessed in the same way as Provision Reports
Lets see using the Groovy Program to call the REST API for exporting the user Audit Reports
Function to Export the User Audit Report
Function to Export, Download and Delete the Provision report from the PBCS Instance
Output of the Groovy Program
Export of the User Audit Report run by the program shown below,

3.REST API for Getting & Set Daily Maintenance Window time on Oracle PBCS\EPBCS

Kindly note the documentation needs to be corrected on the REST API resource and the Groovy function. Feel free to use the function and the Recourse used here.

From the Document: GET /interop/rest/{api_version}/dailymaintenance

Correct Resource is
GET /interop/rest/{api_version}/services/dailymaintenance

api version is v1

From the Document:
def getMaintenanceDetails () {
        def url;
        try {
                        url = new URL(serverUrl + "/interop/rest/v1/maintenancedetails ")
        } catch (MalformedURLException e) {
                        println "Malformed URL. Please pass valid URL"
        response = executeRequest(url, "GET", null);
        def object = new JsonSlurper().parseText(response)
        def status = object.status
        if (status == 0 ) {
                def items = object.items
                println "List of items :"
                        println "Build Version : " + it.buildVersion
                        println "AMW Time : " + it.amwTime
                        println "Link : " + it.links[0].href + "\n"
        } else {
                println "Error occurred while listing versions"
                if (object.details != null)
                                println "Error details: " + object.details
Correct Function to Get & Set the Daily Maintenance Window Time
Output of the Groovy Program

Will come back with the Groovy Program for the DataManagement REST API in the next post, have fun.....

1 comment:

  1. i really like this article. nice and good article. yes I'm agree with you,i will share it with others. thanks for sharing the article with us.
    ERP Systems, Solutions and Services