Add Groups (v2)
The Add Groups (v2) REST API adds groups that are provided in the request payload. These groups can be viewed in Access Control.
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 user running this API must be authorized to perform this action. This API should be run only by a Service Administrator in the environment where groups are to be added. With this API, you can see which records failed and the reason why they failed in addition to how many records passed and failed.
The API is synchronous and returns the outcome of the operation in the response. Any non-zero status indicates failure of adding groups.
This API is version v2.
Required Roles
Service Administrator or Access Control – Manage
REST Resource
POST /interop/rest/security/v2/groups/add
Note:
Before using the REST resources, you must understand how to access the REST resources and other important concepts. See Implementation Best Practices for Cloud EPM REST APIs. Using this REST API requires prerequisites. See Prerequisites.
Table 12-53 Tasks for Add Users to Group
Task | Request | REST Resource |
---|---|---|
Add groups | POST | /interop/rest/security/v2/groups/add |
Request
Supported Media Types: application/json
The following table summarizes the POST request parameters.
Table 12-54 Parameters
Name | Description | Type | Required | Default |
---|---|---|---|---|
groups |
List of groups to add. | Payload | Yes | None |
Example URL and Payload
https://<BASE-URL>/interop/rest/security/v2/groups/add
{
"groups":
[
{
"groupname": "GroupA",
"description": "GroupADescription"
},
{
"groupname": "GroupB",
"description": "GroupBDescription"
}
]
}
Response
Supported Media Types: application/json
Table 12-55 Parameters
Name | Description |
---|---|
links |
Detailed information about the link and HTTP call type |
status |
Identifies the status of the operation
|
error |
Detailed information about the error |
details |
Detailed status of the operation performed. Total number of records processed, succeeded, and failed, and the reason for why they failed. |
Examples of Response Body
The following examples show the contents of the response body in JSON format:
Example 1: Job Completes without Errors
{
"links": {
"href": "https://<BASE-URL>/interop/rest/security/v2/groups/add",
"action": "POST"
},
"status": 0,
"error": null,
"details": {
"processed": 2,
"succeeded": 2,
"failed": 0,
"faileditems": null
}
}
Example 2: Job Completes with Errors
{
"links": {
"href": "https://<BASE-URL>/interop/rest/security/v2/groups/add",
"action": "POST"
},
"status": 1,
"error": {
"errorcode": "EPMCSS-21119",
"errormessage": "Failed to add groups. Invalid or insufficient parameters specified. Provide all required parameters for the REST API."
},
"details": null
}
Example 3: Job Completes with Partial Errors
{
"links": {
"href": "https://<BASE-URL>/interop/rest/security/v2/groups/add",
"action": "POST"
},
"status": 0,
"error": null,
"details": {
"processed": 5,
"succeeded": 3,
"failed": 2,
"faileditems":
[
{
"groupname": "GroupA",
"errorcode": "EPMCSS-21140",
"errormessage": "Failed to add group. Group already exists in System. Provide different group name."
},
{
"groupname": "GroupB",
"errorcode": "EPMCSS-21140",
"errormessage": "Failed to add group. Group already exists in System. Provide different group name."
}
]
}
}
Sample cURL Command Basic Auth
curl -X POST -s -u '<USERNAME>:<PASSWORD>' -H 'Content-Type: application/json' -d '{"groups":[{"groupname":"GroupA","description":"GroupADescription"},{"groupname":"GroupB","description":"GroupBDescription"}]}' 'https://<BASE-URL>/interop/rest/security/v2/groups/add'
Sample cURL Command OAuth 2.0
curl -X POST --header "Authorization: Bearer <OAUTH_ACCESS_TOKEN>" -H 'Content-Type: application/json' -d '{"groups":[{"groupname":"GroupA","description":"GroupADescription"},{"groupname":"GroupB","description":"GroupBDescription"}]}' 'https://<BASE-URL>/interop/rest/security/v2/groups/add'