Add Users to a Group (v1)

Adds a batch of users to an existing group in Access Control using an ANSI or UTF-8 encoded CSV file that was uploaded to the environment. Use the Upload REST API to upload the file. The file should be deleted after the API executes. The file format is as follows:

User Login
<user name>
<email>

Note:

A user is added to the group only if both these conditions are met:

  • User login IDs included in the file exist in the identity domain that services the environment
  • The user is assigned to a pre-defined role in the identity domain

This API should be run only by a service administrator in the identity domain where users are to be added to the group.

The API is asynchronous and returns the Job ID. Use the job status URI to determine whether the assignment of users to the group is complete. The presence of status -1 in the response indicates that the addition of users to a group is in progress. Any non-zero status except -1 indicates failure of adding users. With this API, you can see which records failed and the reason why they failed in addition to how many records passed and failed.

Required Roles

Service Administrator or any predefined role and the Access Control - Manage granular role

REST Resource

PUT /interop/rest/security/v1/groups

Table 13-26 Tasks for Add Users to Group

Task Request REST Resource
Add users to group PUT /interop/rest/security/v1/groups
Add users to group status GET /interop/rest/security/v1/jobs/<jobId>

Request

Supported Media Types: application/x-www-form-urlencoded

Table 13-27 Parameters

Name Description Type Required Default
jobtype The string should have the value ADD_USERS_TO_GROUP. This value denotes that the users are being added to the group. Form Yes None
filename

The name of the uploaded ANSI or UTF-8 encoded CSV file containing the users to add, such as addUsersToGroup.csv.

The file must have been uploaded already using the Upload REST API.

Form Yes None
groupname The name of group to which the users must be added. This group must be a pre-existing group. Form Yes None

Response

Supported Media Types: application/json

Table 13-28 Parameters

Name Description
details In the 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 or status API
action The HTTP call type
rel Possible values: self or Job Status. If the value is set to Job Status, you can use the href to get the status
data Parameters as key value pairs passed in the request
items Details about the resource
links Details of the first URL to be requested to get the job details; rel is "Job Details"

Examples of Response Body

Example 1: Job is in Progress

{
  "links": [
    {
      "rel": "self",
      "href": "https://<BASE-URL>/interop/rest/security/<api_version>/groups",
      "data": {
        "jobType": "ADD_USERS_TO_GROUP",
        "filename": "<fileName>",
        "groupName": "<groupName>",
      },
      "action": "GET"
    },
    {
      "rel": "Job Status",
      "href": "https://<BASE-URL>/interop/rest/security/<api_version>/jobs/<jobId>",
      "data": null,
      "action": "GET"
    }
  ],
  "details": null,
  "status": -1,
  "items": null
}

Example 2: Job Completes with Errors

{
  "links": [
    {
      "rel": "self",
      "href": "https://<BASE-URL>/interop/rest/security/<api_version>/jobs/<jobID>",
      "data": null,
      "action": "GET"
    }
  ],
  "details": "Failed to add users to group. Input file <fileName> is not found. Specify a valid file name.",
  "status": 1,
  "items": null
}

Example 3: Job Completes without Errors

{
  "links": [
    {
      "rel": "self",
      "href": "https://<BASE-URL>/interop/rest/security/<api_version>/jobs/<jobId>",
      "data": null,
      "action": "GET"
    }
  ],
  "details": "Processed - 3, Succeeded - 2, Failed - 1.",
  "status": 0,
  "items": [
    {
		"UserName":"<USERNAME>","Error_Details": "User <USERNAME> is not found. Verify that the user exists."
    }
   ] 
}

Sample cURL Command Basic Auth

curl -X PUT -s -u '<USERNAME>:<PASSWORD>' -H'Content-Type: application/x-www-form-urlencoded' -d 'jobtype=ADD_USERS_TO_GROUP&filename=addUsersToGroup.csv&groupname=GroupA' 'https://<BASE-URL>/interop/rest/security/v1/groups'
curl -X PUT -s -u 'alla.baksh@oracle.com:EPM_Welc0me!1' -H'Content-Type: application/x-www-form-urlencoded' -d 'jobtype=ADD_USERS_TO_GROUP&filename=addUsersToGroup.csv&groupname=GroupA' 'https://epm-test-ociplanning.epm.us-ashburn-1.ocs.oc-test.com/interop/rest/security/v1/groups'

Sample cURL Command OAuth 2.0

curl -X PUT --header "Authorization: Bearer <OAUTH_ACCESS_TOKEN>" -H 'Content-Type: application/x-www-form-urlencoded' -d 'jobtype=ADD_USERS_TO_GROUP&filename=<CSV-FILE-NAME>&groupname=<GROUPNAME>' 'https://<BASE-URL>/interop/rest/security/v1/groups'