createRole
post
/ccadmin/v1/roles
Creates a new role. Roles can be of 2 types - 'role' and 'organizationalRole'. All organizationalRoles are created relative to an organization and have the function as 'custom'. If no type is specified, role of type 'role' is created. Optionally takes the x-ccasset-language header to create role content in another language.
Request
Supported Media Types
- application/json
Query Parameters
-
preview: boolean
If set to true, creates a role for preview users. Defaults to false.
Header Parameters
-
X-CCAsset-Language: string
The asset language of the request.
Root Schema : createRole_request
Type:
Show Source
object
-
accessRights:
array accessRights
Access rights to assign to role
-
category:
object category
Category of the role
-
description:
string
Description of role
-
function:
string
Function for the organizationalRole. Possible values are - custom. Not allowed with type role.
-
name(required):
string
Name of role
-
relativeTo:
object relativeTo
Organization for which the organizational role must be created. Required for type organizationalRole. Not allowed with type role.
-
repositoryId:
string
Repository ID of role
-
type:
string
Type of role to be created. Possible values are - role (default) and organizationalRole.
Example:
{
"name":"Custom Role",
"repositoryId":"customRole",
"description":"Custom Role",
"accessRights":[
{
"repositoryId":"customAccessRight1"
}
]
}
Nested Schema : category
Type:
object
Category of the role
Show Source
-
displayName:
string
Display name of the role category.
-
id:
string
ID of the role category.(customRoleCategory or storefrontRoleCategory)
-
repositoryId:
string
Repository ID of the role category.(customRoleCategory or storefrontRoleCategory)
Nested Schema : relativeTo
Type:
object
Organization for which the organizational role must be created. Required for type organizationalRole. Not allowed with type role.
Show Source
-
id:
string
Repository ID of organization
Response
Supported Media Types
- application/json
200 Response
Following model is returned when operation succeeds.
Root Schema : getRole_response
Type:
Show Source
object
-
accessRights:
array accessRights
Access rights assigned to role
-
category:
object category
Category of the role
-
description:
string
Description of role
-
function:
string
Function name for organizationRole
-
id:
string
ID of role
-
name:
string
Name of role
-
relativeTo:
object relativeTo
Related organization for organizationRole
-
repositoryId:
string
Repository ID of role
-
type:
string
Type of role (role or organizationalRole)
Nested Schema : category
Type:
object
Category of the role
Show Source
-
displayName:
string
Display name of the role category.
-
id:
string
ID of the role category.(customRoleCategory or storefrontRoleCategory)
-
repositoryId:
string
Repository ID of the role category.(customRoleCategory or storefrontRoleCategory)
Nested Schema : relativeTo
Type:
object
Related organization for organizationRole
Show Source
-
externalOrganizationId:
string
External organization id
-
id:
string
Repository ID of related organization
Nested Schema : items
Type:
Show Source
object
-
description:
string
Description of access right
-
displayName:
string
Display name of access right
-
id:
string
ID of access right
-
name:
string
Name of access right
-
repositoryId:
string
Repository ID of access right
-
type:
string
Type of access right
Example Response (application/json)
{
"name":"Custom Role",
"repositoryId":"customRole",
"description":"Custom Role",
"id":"customRole",
"accessRights":[
{
"displayName":"Custom Access Right 1",
"name":"Custom Access Right 1",
"repositoryId":"customAccessRight1",
"description":"Custom Access Right 1",
"id":"customAccessRight1",
"type":"generic"
}
],
"type":"role",
"category":{
"displayName":"Custom Roles",
"repositoryId":"customRoleCategory",
"id":"customRoleCategory"
}
}
Default Response
The error response.
The following are the internal error codes thrown by this API when the request processing fails in Oracle Commerce Cloud:
|Error Code|Description|
|------------------|------------------|
|22047|If input passed is invalid|
|22055|If type, relativeTo or function passed are invalid|
|22102|If a restricted privilege is being added to an organizationalRole|
Root Schema : errorModel
Type:
Show Source
object
-
devMessage:
string
An optional non-localized message containing technical information for developers
-
errorCode:
string
The numerical code identifying the error
-
errors:
array errors
An optional list of errors if multiple errors were encountered
-
message:
string
The localized message describing the error
-
moreInfo:
string
An optional non-localized message with more information
-
o:errorPath:
string
An optional machine readable description of where the error occurred
-
status:
string
The HTTP status code
-
type:
string
The URI to the HTTP state code definition
Nested Schema : errors
Type:
array
An optional list of errors if multiple errors were encountered
Show Source
Nested Schema : items
Type:
Show Source
object
-
devMessage:
string
An optional non-localized message containing technical information for developers
-
errorCode:
string
The numerical code identifying the error
-
message:
string
The localized message describing the error
-
moreInfo:
string
An optional non-localized message with more information
-
o:errorPath:
string
An optional machine readable description of where the error occurred
-
status:
string
The HTTP status code