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
_linksobjectSpecifies link relations (see Web Linking) available for the current status of an application using the JSON Hypertext Application Language specification. Use the LinksNext object for dynamic discovery of related resources and lifecycle operations.
rolesarray

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_rolesselectsubdomainafterLists all custom roles with pagination support
get_roleselectsubdomainRetrieves a role by roleIdOrLabel
create_roleinsertsubdomain, data__label, data__description, data__permissionsCreates a custom role
replace_rolereplacesubdomain, data__label, data__descriptionReplaces the label and description for a custom role by roleIdOrLabel
delete_roledeletesubdomainDeletes 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
subdomainstringThe domain of your organization. This can be a provided subdomain of an official okta domain (okta.com, oktapreview.com, etc) or one of your configured custom domains. (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.

SELECT examples

Lists all custom roles with pagination support

SELECT
_links,
roles
FROM okta.iam.roles
WHERE subdomain = '{{ subdomain }}' -- required
AND after = '{{ after }}'
;

INSERT examples

Creates a custom role

INSERT INTO okta.iam.roles (
data__description,
data__label,
data__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
data__description = '{{ description }}',
data__label = '{{ label }}'
WHERE
subdomain = '{{ subdomain }}' --required
AND data__label = '{{ label }}' --required
AND data__description = '{{ description }}' --required
RETURNING
id,
_links,
created,
description,
label,
lastUpdated
;

DELETE examples

Deletes a custom role by roleIdOrLabel

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