Retrieving a Specific Role ID Using the Roles Endpoint with Filter Option

Retrieving a Specific Role ID Using the /odata/roles Endpoint with Filter Option.

Issue: Retrieving a Specific Role ID Using the /odata/roles Endpoint

To retrieve the role ID of a particular role by providing the role name as an input. While using the Swagger interface, shall be able to get the IDs for all roles but required assistance in obtaining the ID for a single role based on its name.

Resolution: Follow these steps to configure the endpoint in the Studio to retrieve the role ID of a specific role using the filter option:

Endpoint Configuration:

  1. Configure the following endpoint to filter roles by name:

/odata/Roles?$filter=startswith(Name,'RoleName')

  1. Replace 'RoleName' with the specific role name you are looking for. For example, to retrieve the ID of the role named "Administrator," the endpoint would be

/odata/Roles?$filter=startswith(Name,'Administrator')

Using Swagger to Pass Information:

  1. Open the Swagger interface
  2. Navigate to the /odata/Roles endpoint
  3. In the parameters section, input the filter query as shown above
  4. Execute the request to see the filtered results, which will include the ID of the specified role
image.png


Handling Custom Roles:

It was demonstrated that using the filter startswith(Name, 'Administrator') is effective for retrieving the role ID of a particular role. However, for custom roles, we recommend renaming them, as using other string functions with different sub-attributes may return all roles related to those sub-attributes. Therefore, to ensure accurate retrieval, proceed with renaming the custom roles and utilize the mentioned filter.

By following these steps, it should be possible to retrieve the ID of a specific role by providing its name as input.