getRoleById

The getRoleById method is used to retrieve detailed information about a specific role based on its unique identifier (id). This method searches through the available roles and returns the role that matches the given id. If the role does not exist, an error is thrown.

Parameters

id (number): The unique identifier of the role that you want to retrieve. This id is used to search for the specific role within the available roles.

Returns

Promise<IRole>: A promise that resolves to an IRole object, which contains detailed information about the role, such as its id, name, description, and value.

Usage Example


// Define the role ID you want to retrieve
const roleId = 456; // Example role ID

// Retrieve the role details using the getRole method
sdk.rolesService.getRole(roleId)
  .then((role) => {
    console.log('Role details:', role);
    // Role details will include id, name, description, and value
  })
  .catch((error) => {
    console.error('Error retrieving role:', error);
    // Handle the case where the role was not found
  });