Okta.Sdk.Api.RoleECustomApi
October 22, 2025 ยท View on GitHub
All URIs are relative to https://subdomain.okta.com
| Method | HTTP request | Description |
|---|---|---|
| CreateRole | POST /api/v1/iam/roles | Create a custom role |
| DeleteRole | DELETE /api/v1/iam/roles/{roleIdOrLabel} | Delete a custom role |
| GetRole | GET /api/v1/iam/roles/{roleIdOrLabel} | Retrieve a role |
| ListRoles | GET /api/v1/iam/roles | List all custom roles |
| ReplaceRole | PUT /api/v1/iam/roles/{roleIdOrLabel} | Replace a custom role |
CreateRole
IamRole CreateRole (CreateIamRoleRequest instance)
Create a custom role
Creates a custom role
Example
using System.Collections.Generic;
using System.Diagnostics;
using Okta.Sdk.Api;
using Okta.Sdk.Client;
using Okta.Sdk.Model;
namespace Example
{
public class CreateRoleExample
{
public static void Main()
{
Configuration config = new Configuration();
config.OktaDomain = "https://subdomain.okta.com";
// Configure API key authorization: apiToken
config.Token ="YOUR_API_KEY";
// Configure OAuth2 access token for authorization: oauth2
config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new RoleECustomApi(config);
var instance = new CreateIamRoleRequest(); // CreateIamRoleRequest |
try
{
// Create a custom role
IamRole result = apiInstance.CreateRole(instance);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling RoleECustomApi.CreateRole: " + e.Message );
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| instance | CreateIamRoleRequest |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 200 | Success | - |
| 400 | Bad Request | - |
| 403 | Forbidden | - |
| 429 | Too Many Requests | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
DeleteRole
void DeleteRole (string roleIdOrLabel)
Delete a custom role
Deletes a custom role by roleIdOrLabel
Example
using System.Collections.Generic;
using System.Diagnostics;
using Okta.Sdk.Api;
using Okta.Sdk.Client;
using Okta.Sdk.Model;
namespace Example
{
public class DeleteRoleExample
{
public static void Main()
{
Configuration config = new Configuration();
config.OktaDomain = "https://subdomain.okta.com";
// Configure API key authorization: apiToken
config.Token ="YOUR_API_KEY";
// Configure OAuth2 access token for authorization: oauth2
config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new RoleECustomApi(config);
var roleIdOrLabel = cr0Yq6IJxGIr0ouum0g3; // string | `id` or `label` of the role
try
{
// Delete a custom role
apiInstance.DeleteRole(roleIdOrLabel);
}
catch (ApiException e)
{
Debug.Print("Exception when calling RoleECustomApi.DeleteRole: " + e.Message );
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| roleIdOrLabel | string | `id` or `label` of the role |
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 204 | No Content | - |
| 403 | Forbidden | - |
| 404 | Not Found | - |
| 429 | Too Many Requests | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
GetRole
IamRole GetRole (string roleIdOrLabel)
Retrieve a role
Retrieves a role by roleIdOrLabel
Example
using System.Collections.Generic;
using System.Diagnostics;
using Okta.Sdk.Api;
using Okta.Sdk.Client;
using Okta.Sdk.Model;
namespace Example
{
public class GetRoleExample
{
public static void Main()
{
Configuration config = new Configuration();
config.OktaDomain = "https://subdomain.okta.com";
// Configure API key authorization: apiToken
config.Token ="YOUR_API_KEY";
// Configure OAuth2 access token for authorization: oauth2
config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new RoleECustomApi(config);
var roleIdOrLabel = cr0Yq6IJxGIr0ouum0g3; // string | `id` or `label` of the role
try
{
// Retrieve a role
IamRole result = apiInstance.GetRole(roleIdOrLabel);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling RoleECustomApi.GetRole: " + e.Message );
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| roleIdOrLabel | string | `id` or `label` of the role |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 200 | OK | - |
| 403 | Forbidden | - |
| 404 | Not Found | - |
| 429 | Too Many Requests | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
ListRoles
IamRoles ListRoles (string after = null)
List all custom roles
Lists all custom roles with pagination support
Example
using System.Collections.Generic;
using System.Diagnostics;
using Okta.Sdk.Api;
using Okta.Sdk.Client;
using Okta.Sdk.Model;
namespace Example
{
public class ListRolesExample
{
public static void Main()
{
Configuration config = new Configuration();
config.OktaDomain = "https://subdomain.okta.com";
// Configure API key authorization: apiToken
config.Token ="YOUR_API_KEY";
// Configure OAuth2 access token for authorization: oauth2
config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new RoleECustomApi(config);
var after = "after_example"; // string | The 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](https://developer.okta.com/docs/api/#pagination). (optional)
try
{
// List all custom roles
IamRoles result = apiInstance.ListRoles(after);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling RoleECustomApi.ListRoles: " + e.Message );
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| after | string | The 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. | [optional] |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: application/json
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 200 | OK | - |
| 403 | Forbidden | - |
| 429 | Too Many Requests | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
ReplaceRole
IamRole ReplaceRole (string roleIdOrLabel, UpdateIamRoleRequest instance)
Replace a custom role
Replaces the label and description for a custom role by roleIdOrLabel
Example
using System.Collections.Generic;
using System.Diagnostics;
using Okta.Sdk.Api;
using Okta.Sdk.Client;
using Okta.Sdk.Model;
namespace Example
{
public class ReplaceRoleExample
{
public static void Main()
{
Configuration config = new Configuration();
config.OktaDomain = "https://subdomain.okta.com";
// Configure API key authorization: apiToken
config.Token ="YOUR_API_KEY";
// Configure OAuth2 access token for authorization: oauth2
config.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new RoleECustomApi(config);
var roleIdOrLabel = cr0Yq6IJxGIr0ouum0g3; // string | `id` or `label` of the role
var instance = new UpdateIamRoleRequest(); // UpdateIamRoleRequest |
try
{
// Replace a custom role
IamRole result = apiInstance.ReplaceRole(roleIdOrLabel, instance);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling RoleECustomApi.ReplaceRole: " + e.Message );
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| roleIdOrLabel | string | `id` or `label` of the role | |
| instance | UpdateIamRoleRequest |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 200 | OK | - |
| 400 | Bad Request | - |
| 403 | Forbidden | - |
| 404 | Not Found | - |
| 429 | Too Many Requests | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]