Add Users to an Identity Domain (v2)

The Add Users to an Identity Domain (v2) REST API adds users that are provided in the request payload. It sends each new user an email with details about their accounts (user name and password) if resetpassword is set to true. If resetpassword is set to false, the email is not sent. If you set resetpassword to false, you should specify userpassword; otherwise, a unique temporary password will be assigned to each user; but, because no email is sent, the users will not know that password and they will not be able to log in. If a user definition in the payload matches a user account that exists in the identity domain, no changes are made to the existing user account. This API creates accounts only for new users whose account information is provided in the payload. Because user accounts are common to all service environments that an identity domain supports, new users are available to all the environments that share the identity domain.

This API should be run only by an Identity Domain Administrator in the identity domain where users will be created. In addition, the user running the API must also be assigned a predefined role in the environment where the API is targeted. 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 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 adding users.

This API is version v2.

Required Roles

Identity Domain Administrator and any predefined role (Service Administrator, Power User, User, or Viewer)

Table 11-5 Tasks for Add Users

Task Request REST Resource
Add users POST /interop/rest/security/v2/users/add

REST Resource

POST /interop/rest/security/v2/users/add

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 POST request parameters.

Table 11-6 Parameters

Name Description Type Required Default
users

List of users to add

Payload Yes None

Example URL and Payload

https://<SERVICE_NAME>-<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/interop/rest/security/v2/users/add
{
	"users": 
	[
		{
			"firstname": "Jane",
			"lastname": "Doe",
			"email": "jane.doe@discard.oracle.com",
			"userlogin": "jdoe",
			"resetpassword": true
		},
		{
			"firstname": "chris",
			"lastname": "west",
			"email": "chris.west@discard.oracle.com",
			"userlogin": "chris",
			"password": "userPassword",
			"resetpassword": false
    		}      
	]
}

Response

Supported Media Types: application/json

Table 11-7 Parameters

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

Identifies the status of the operation

  • 0: Operation succeeded
  • 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 why they failed.

Example 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://<SERVICE_NAME>-<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/interop/rest/security/v2/users/add",
    		"action": "POST"
	},
	"status": 0,
	"error": null,
	"details": {
		"processed": 3,
		"succeeded": 3,
		"failed": 0,
		"faileditems": null
	}
}

Example 2: Job Completes with Errors

{
	"links": {
    		"href": "https://<SERVICE_NAME>-<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/interop/rest/security/v2/users/add",
    		"action": "POST"
	},
	"status": 1,
	"error": {
		"errorcode": "EPMCSS-21146",
		"errormessage": "Failed to add users. 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://<SERVICE_NAME>-<TENANT_NAME>.<SERVICE_TYPE>.<dcX>.oraclecloud.com/interop/rest/security/v2/users/add",
    		"action": "POST"
	},
	"status": 0,
	"error": null,
	"details": {
		"processed": 5,
		"succeeded": 3,
		"failed": 2,
		"faileditems": 
		[
		{
                		"userlogin": "jdoe",
                		"errorcode": "EPMCSS-21150",
                		"errormessage": "Failed to add user. Invalid email jdoe.com. Please provide a valid email."
           	},
            	{
                		"userlogin": "chris",
                		"errorcode": "EPMCSS-21151",
                		"errormessage": "Failed to add user. Missing [firstname]. Please provide value: [firstname]."
            	}
		]
	}
} 

Sample cURL Command Basic Auth

curl -X POST -s -u '<USERNAME>:<PASSWORD>' -H
'Content-Type: application/json' -d'{"users":[{"firstname":"<FIRSTNAME>","lastname":"<LASTNAME>",
"email":"<EMAIL>","userlogin":"<USERLOGIN>","password":"<PASSWORD>","resetpassword":<TRUE/FALSE>}]}'
'https://<EPM-CLOUD-BASE-URL>/interop/rest/security/v2/users/add'

Sample cURL Command OAuth 2.0

curl -X POST --header "Authorization: Bearer <OAUTH_ACCESS_TOKEN>" -H
'Content-Type: application/json' -d '{"users":[{"firstname":"<FIRSTNAME>","lastname":"<LASTNAME>",
"email":"<EMAIL>","userlogin":"<USERLOGIN>","password":"<PASSWORD>","resetpassword":<TRUE/FALSE>}]}
' 'https://<EPM-CLOUD-BASE-URL>/interop/rest/security/v2/users/add'