Create one or more users
post
/rest/users
Creates one or more users in one request and supports multiple effective-dated role assignments per user. The complete batch is passed to the existing SOAP-compatible UserService business logic. A single-user response includes a Location header; batch responses omit it.
Request
Header Parameters
-
Password(required):
Application password.
-
PasswordType(required):
Password type (case-sensitive). Use PasswordText. PasswordDigest requires webservice.allowHashedPassword=Yes.
-
Username(required):
Application username.
Response
201 Response
User or users created.
Headers
-
Location:
Self URI for a single created user; omitted for batch creation.
400 Response
Invalid collection, missing field, duplicate value, invalid date, locale, company, or role data.
401 Response
Authentication failed.
403 Response
Authorization failed for UserService/createUser.
409 Response
User already exists or role assignment conflicts.
500 Response
Uncatalogued business or internal processing error.
Examples
This example describes how to create one or more users.
Example cURL Command
Use the following cURL command to submit a request on the REST resource:
curl -X POST \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-u username:password \
"http://server:port/PASJava/rest/users" \
-d '{"Use this placeholder to plug-in the example request body given below"}' Example Request Body in JSON Format
The following shows an example of the request body in JSON format:
{
"users": [
{
"userId": "{{user1}}",
"firstName": "Daniel",
"lastName": "Wilson",
"gender": "M",
"email": "daniel.wilson@example.com",
"primaryCompany": "{{primaryCompany}}",
"locale": "{{locale}}",
"password": "{{newUserPassword}}",
"roles": [
{
"roleName": "{{roleOne}}",
"effectiveFrom": "{{effectiveFrom}}",
"effectiveTo": "{{effectiveTo}}"
},
{
"roleName": "{{roleTwo}}",
"effectiveFrom": "{{effectiveFrom}}",
"effectiveTo": "{{effectiveTo}}"
}
]
}
]
}
Example Response Body in JSON Format
The following shows an example of the response body in JSON format:
{
"users": [
{
"userId": "REST_P2_DWILSON_1789483360655",
"self": "http://fsgbu-mum-748.snbomprshared1.gbucdsint02bom.oraclevcn.com:7001/PASJava/rest/users?userId=REST_P2_DWILSON_1789483360655"
}
]
}
Example Request Body in XML Format
The following shows an example of the request body in XML format:
<users>
<user>
<userId>{{user1}}</userId>
<firstName>Daniel</firstName>
<lastName>Wilson</lastName>
<gender>M</gender>
<email>daniel.wilson@example.com</email>
<primaryCompany>{{primaryCompany}}</primaryCompany>
<locale>{{locale}}</locale>
<password>{{newUserPassword}}</password>
<roles>
<role>
<roleName>{{roleOne}}</roleName>
<effectiveFrom>{{effectiveFrom}}</effectiveFrom>
<effectiveTo>{{effectiveTo}}</effectiveTo>
</role>
<role>
<roleName>{{roleTwo}}</roleName>
<effectiveFrom>{{effectiveFrom}}</effectiveFrom>
<effectiveTo>{{effectiveTo}}</effectiveTo>
</role>
</roles>
</user>
</users>
Example Response Body in XML Format
The following shows an example of the response body in XML format:
<users>
<user>
<userId>REST_P2_DWILSON_1789483360655</userId>
<self>http://fsgbu-mum-748.snbomprshared1.gbucdsint02bom.oraclevcn.com:7001/PASJava/rest/users?userId=REST_P2_DWILSON_1789483360655</self>
</user>
</users>