Remove Users from a Group (v2)

The Remove Users from a Group (v2) REST API removes a batch of users from an existing group provided in the REST API payload.

Note:

A user is removed from a group only if both of these conditions are met:

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

This topic describes the simplified v2 version of this REST API. This version contains all parameters in the payload and does not require URL encoding while calling the REST APIs. This makes the v2 API easier to use.

The API is synchronous and returns the outcome of the operation in the response. Any non-zero status indicates failure of removing users from group. With this API, you can see which records failed and the reason why they failed, in addition to how many records passed and failed.

This API is version v2.

Required Roles

Service Administrator or Access Control Manager

Table 11-35 Tasks for Remove Users from Group

Task Request REST Resource
Remove users from group PUT /interop/rest/security/v2/groups/removeusersfromgroup

REST Resource

PUT /interop/rest/security/v2/groups/removeusersfromgroup

Supported Media Types: application/json

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 11-36 Parameters

Name Description Type Required Default
groupname The name of group from which the users must be removed. This group must be a pre-existing group. Payload Yes None
users List of userlogin IDs of the users to be removed from group. Payload Yes None

Example URL and Payload

https://<SERVICE_NAME>-<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/interop/rest/security/v2/groups/removeusersfromgroup
{
  	"groupname": "G1",
	"users": 	[
        		{
			"userlogin": "jdoe"
        		},
        		{
                    "userlogin": "chris"
        		}
    	]
}

Response

Supported Media Types: application/json

Table 11-37 Parameters

Name Description
links Detailed information about the link and HTTP call type
status

Identifies the status of the operation

  • 0: Operation Success

  • 1: Operation Failed

error Detailed information about the error
details Detailed status of the operation performed. Total number of records processed, succeeded, and failed and reason for why it failed.

Example of Response Body

The following examples show the contents of the response body in JSON format:

Example 1: REST API Completes without Errors

{
	"links": {
    		"href": "https://<SERVICE_NAME>-<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/interop/rest/security/v2/groups/removeusersfromgroup",
    		"action": "PUT"
	},
	"status": 0,
	"error": null,
	"details": {
		"processed": 3,
		"succeeded": 3,
		"failed": 0,
		"faileditems": null
	}
}

Example 2: REST API Completes with Errors

{
	"links": {
    		"href": "https://<SERVICE_NAME>-<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/interop/rest/security/v2/groups/removeusersfromgroup",
    		"action": "PUT"
	},
	"status": 1,
	"error": {
		"errorcode": "EPMCSS-21022",
		"errormessage": "Failed to remove users from group. Group <groupname> does not exist. Provide a valid groupname."
	},
	"details": null
}

Example 3: REST API Completes with Partial Errors

{
	"links": {
    		"href": "https://<SERVICE_NAME>-<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/interop/rest/security/v2/groups/removeusersfromgroup",
    		"action": "PUT"
	},
	"status": 0,
	"error": null,
	"details": {
		"processed": 5,
		"succeeded": 3,
		"failed": 2,
		"faileditems": 
		[
			{
				"userlogin": "jdoe",
				"errorcode": "EPMCSS-21032",
				"errormessage": "Failed to remove user from group. User jdoe does not exist. Provide a valid userlogin."
			},
			{
				"userlogin": "chris",
				"errorcode": "EPMCSS-21032",
				"errormessage": "Failed to remove user from group. User chris does not exist. Provide a valid userlogin."
			}
		]
	}
}

Sample cURL command

curl -X PUT -s -u '<USERNAME>:<PASSWORD>' -o response.txt -D respHeader.txt -H
'Content-Type: application/json' -d
'{"groupname":"G1","users":[{"userlogin":"jdoe"},{"userlogin":"chris"}]}'
'https://<SERVICE_NAME>-
<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/interop/rest/security/v2/groups/
removeusersfromgroup'