Skip to main content

roles

Creates, updates, deletes, gets or lists a roles resource.

Overview​

Nameroles
TypeResource
Idokta.iam.roles

Fields​

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringUnique key for the role
_linksobjectSpecifies link relations (see Web Linking) available using the JSON Hypertext Application Language specification. This object is used for dynamic discovery of related resources and lifecycle operations.
createdstring (date-time)Timestamp when the role was created
descriptionstringDescription of the role
labelstringUnique label for the role
lastUpdatedstring (date-time)Timestamp when the role was last updated

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_roleselectroleIdOrLabel, subdomainRetrieves a role by roleIdOrLabel
list_rolesselectsubdomainafterLists all custom roles with pagination support
create_roleinsertsubdomain, label, description, permissionsCreates a custom role
replace_rolereplaceroleIdOrLabel, subdomain, label, descriptionReplaces the label and description for a custom role by roleIdOrLabel
delete_roledeleteroleIdOrLabel, subdomainDeletes a custom role by roleIdOrLabel

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
roleIdOrLabelstringid or label of the role
subdomainstring(default: my-org)
afterstringThe cursor to use for pagination. It is an opaque string that specifies your current location in the list and is obtained from the Link response header. See Pagination and Link header.

SELECT examples​

Retrieves a role by roleIdOrLabel

SELECT
id,
_links,
created,
description,
label,
lastUpdated
FROM okta.iam.roles
WHERE roleIdOrLabel = '{{ roleIdOrLabel }}' -- required
AND subdomain = '{{ subdomain }}' -- required
;

INSERT examples​

Creates a custom role

INSERT INTO okta.iam.roles (
description,
label,
permissions,
subdomain
)
SELECT
'{{ description }}' /* required */,
'{{ label }}' /* required */,
'{{ permissions }}' /* required */,
'{{ subdomain }}'
RETURNING
id,
_links,
created,
description,
label,
lastUpdated
;

REPLACE examples​

Replaces the label and description for a custom role by roleIdOrLabel

REPLACE okta.iam.roles
SET
description = '{{ description }}',
label = '{{ label }}'
WHERE
roleIdOrLabel = '{{ roleIdOrLabel }}' --required
AND subdomain = '{{ subdomain }}' --required
AND label = '{{ label }}' --required
AND description = '{{ description }}' --required
RETURNING
id,
_links,
created,
description,
label,
lastUpdated;

DELETE examples​

Deletes a custom role by roleIdOrLabel

DELETE FROM okta.iam.roles
WHERE roleIdOrLabel = '{{ roleIdOrLabel }}' --required
AND subdomain = '{{ subdomain }}' --required
;