Query for a Role

To assign users with roles, you must know the specific role ID. You can run a query on the available roles and get the unique ID for a specific role. You can then use that ID to assign it to users. To learn how to query, see Querying. Note that when you query, you can only search for existing roles but can't create roles. Let's look at an example of querying for a role.

Use cURL and eq filter parameter with the name field to query the role. In this example, the queried role name is ORA_PER_HUMAN_RESOURCE_ANALYST_JOB.

curl -i -u "<username>:<password>" -H "Content-Type: application/json" -X GET -d <payload> https://servername.fa.us2.oraclecloud.com/hcmRestApi/scim/Roles?filter=name eq "ORA_PER_HUMAN_RESOURCE_ANALYST_JOB"	

Sample Response Payload

{
  "itemsPerPage": 1,
  "startIndex": 1,
  "Resources": [
    {
      "id": "55361929311C580B560EB8BA5C4C1886",
      "meta": {
        "created": "2009-05-12 11:27:39.226",
        "lastModified": "2016-11-17 17:00:46.000",
        "location": "https://servername.fa.us2.oraclecloud.com/hcmRestApi/scim/Roles/55361929311C580B560EB8BA5C4C1886"
      },
      "schemas": [
        "urn:oracle:apps:scim:schemas:fa:1.0:Role"
      ],
      "name": "ORA_PER_HUMAN_RESOURCE_ANALYST_JOB",
      "displayName": "Human Resource Analyst",
      "description": "Performs duties of a human resources analyst.",
      "category": "JOB",
      "members": [
        {
          "value": "258D2199A0BB1AA3E050F00A185B018E"
        },
        {
          "value": "6424EF8136C0C20F12466257D3540E9C"
        }
      ]
    }
  ]
}

The role ID returned in the response is 55361929311C580B560EB8BA5C4C1886. You can use this role ID to assign the role to a user or do any other role-related task.