Role Assignment Report

Generates a Role Assignment Report (.CSV). This report lists the predefined roles (for example, Service Administrator) and application roles (for example, Approvals Ownership Assigner, Approvals Supervisor, Approvals Administrator, and Approvals Process Designer, which are Planning application roles) assigned to users. This report matches the CSV version of the Role Assignment Report generated from Access Control. The API writes the report to the filename provided, and the report can then be downloaded using the Download REST API.

This is an asynchronous job and uses the job status URI to determine if the operation is complete.

The presence of status -1 in the response indicates that the generation of Role Assignment Report is in progress. Use the job status URI to determine whether the generation of Role Assignment Report is complete. Any non-zero status except -1 indicates failure of generating Role Assignment Report.

This API is version v1.

Required Roles

Service Administrator

Table 10-62 User Assignment Report

Task Request REST Resource
Role Assignment Report POST

/interop/rest/security/{api_version}/roleassignmentreport/

Role Assignment Report Status GET

/interop/rest/security/{api_version}/jobs/{jobId}

REST Resource

POST /interop/rest/security/{api_version}/roleassignmentreport

Note:

Before using the REST resources, you must understand how to access the REST resources and other important concepts. See Implementation Best Practices for EPM Cloud REST APIs. Using this REST API requires prerequisites. See Prerequisites.

The following table summarizes the request parameters.

Table 10-63 Parameters

Name Description Type Required Default
api_version Specific API version Path Yes None
filename File name for the file where the report is to be populated, such as roleAssignmentReport.csv Form Yes None

Response

Supported Media Types: application/json

Table 10-64 Parameters

Parameters Description
details In case of errors, details are published with the error string
status See Migration Status Codes
links Detailed information about the link
href Links to API call
action The HTTP call type
rel Can be self and/or Job Status. If set to Job Status, you can use the href to get the status of the import operation
data Parameters as key value pairs passed in the request

Examples of Response Body

The following show examples of the response body in JSON format.

Response 1 example when job is in progress:

{
    "links": [
        {
            "data": {
                "jobType": "GENERATE_ROLE_ASSIGNMENT_REPORT",
                "filename": "<filename>"
            },
            "action": "POST",
            "href": "https://<SERVICE_NAME>-<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/interop/rest/security/<api_version>/jobs/<jobId>",
            "rel": "Job Status"
        }
    ],
    "status": -1,
    "details": null,
    "items": null
}

Response 2 example when job completes with errors:

{
    "links": [
        {
            "data": {
                "jobType": "GENERATE_ROLE_ASSIGNMENT_REPORT",
                "filename": " "
            },
            "action": "POST",
            "href": "https://<SERVICE_NAME>-<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/interop/rest/security/{api_version}/roleassignmentreport",
            "rel": "self"
        }
    ],
    "status": 1,
    "details": "EPMCSS-20665: Failed to generate Role Assignment Report. Invalid or insufficient parameters are specified. Provide all required parameters for the REST API. ",
    "items": null
}

Response 3 example when job completes without errors:

{
    "links": [
        {
            "data": null,
            "action": "GET",
            "href": " https://<SERVICE_NAME>-<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/interop/rest/security/<api_version>/jobs/<jobID>",
            "rel": "self"
        }
    ],
    "status": 0,
    "details": null,
    "items": null
}

Example 10-34 Java Sample Code

Prerequisites: json.jar

Common Functions: See CSS Common Helper Functions for Java

public void generateRoleAssignmentReport(String filename) {
		try {
			String url = this.serverUrl + "/interop/rest/security/" + apiVersion + "/roleassignmentreport";
			Map<String, String> reqHeaders = new HashMap<String, String>();
			reqHeaders.put("Authorization", "Basic " + DatatypeConverter
					.printBase64Binary((this.userName + ":" + this.password).getBytes(Charset.defaultCharset())));

			Map<String, String> reqParams = new HashMap<String, String>();
			reqParams.put("filename", filename);
		
			Map<String, String> restResult = CSSRESTHelper.callRestApi(new HashMap(), url, reqHeaders, reqParams,
					"POST");
			String jobStatus = CSSRESTHelper.getCSSRESTJobCompletionStatus(restResult, reqHeaders);
			System.out.println(jobStatus);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

Example 10-35 Shell Script Sample code

Prerequisites: jq (http://stedolan.github.io/jq/download/linux64/jq)

Common Functions: See CSS Common Helper Functions for cURL

funcGenerateRoleAssignmentReport() {
        url="$SERVER_URL/interop/rest/security/$API_VERSION/roleassignmentreport"
        params="filename=$1"
        header="Content-Type: application/x-www-form-urlencoded;charset=UTF-8"
        cssRESTAPI="generateRoleAssignmentReport"
        statusMessage=$(funcCSSRESTHelper "POST" "$url" "$header" "$USERNAME" "$PASSWORD" "$params" "$cssRESTAPI")
        echo $statusMessage
}	

Example 10-36 Groovy Sample Code

Common Functions: See CSS Common Helper Functions for Groovy

def generateRoleAssignmentReport(filename) {

	String scenario = "Generating Role assignment report in " + filename;
	String params = "jobtype=GENERATE_ROLE_ASSIGNMENT_REPORT&filename="+ filename;
	def url = null;
	def response = null;
	try {
		url = new URL(serverUrl + "/interop/rest/security/" + apiVersion + "/roleassignmentreport");
	} catch (MalformedURLException e) {
		println "Please enter a valid URL"
		System.exit(0);
	}
	response = executeRequest(url, "POST", params, "application/x-www-form-urlencoded");
	if (response != null) {
		getJobStatus(getUrlFromResponse(scenario, response, "Job Status"), "GET");
	}
}