Add Groups (v1)

REST Resource

POST /interop/rest/security/<api_version>/groups

Table 2-58 Tasks for Adding a Batch of Groups

Task Request REST Resource
Create groups POST /interop/rest/security/<api_version>/groups
Create groups status GET /interop/rest/security/<api_version>/jobs/<jobId>

Request

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

Table 2-59 Parameters

Name Description Type Required Default
filename

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

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

File format example:

Group Name,Description
GroupA,GroupADescription
GroupB,GroupBDescription
Form Yes None

Response

Supported Media Types: application/json

Table 2-60 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": [
        {
            "href": "https://<BASE-URL>/interop/rest/security/<api_version>/groups",
            "rel": "self",
            "data": {
                "jobType": "ADD_GROUPS",
                "filename": "<filename>"
            },
            "action": "POST"
        },
        {
            "href": "https://<BASE-URL>/interop/rest/security/<api_version>/jobs/<jobId",
            "rel": "Job Status",
            "data": null,
            "action": "GET"
        }
    ],
    "status": -1,
    "details": null,
    "items": null
}

Example 2: Job Completes with Errors

{
    "links": [
        {
            "href": "https://<BASE-URL>/interop/rest/security/<api_version>/groups",
            "rel": "self",
            "data": {
                "jobType": "ADD_GROUPS",
                "filename": ""
            },
            "action": "POST"
        }
    ],
    "status": 1,
    "details": "EPMCSS-20671: Failed to create groups. Invalid or insufficient parameters specified. Provide all required parameters for the REST API. ",
    "items": null
}

Example 3: Job Completes without Errors

{
    "links": [
        {
            "data": null,
            "action": "GET",
            "href": " https://<BASE-URL>/interop/rest/security/<api_version>/jobs/<jobId>",
            "rel": "self"
        }
    ],
    "status": 0,
    "details": "Processed - 4, Succeeded - 3, Failed - 1.   ",
    "items": [
    {
		"GroupName":"<GROUPNAME>","Error_Details": "Failed to create a group with the name <GROUPNAME>. This group already exists in the system. Provide a different group name."
     }
   ]
}

Sample cURL Command Basic Auth

curl -X POST -s -u '<USERNAME>:<PASSWORD>' -H'Content-Type: application/x-www-form-urlencoded' -d 'filename=<CSV-FILE-NAME>' 'https://<BASE-URL>/interop/rest/security/v1/groups'

Sample cURL Command OAuth 2.0

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