Retrieval

Retrieve a Single Role

Retrieves information on a single Role. The returned data includes general role details.

Method: GET
Path: /pulp/api/v2/roles/<role_id>/
Permission: read
Query Parameters:
Response Codes:
  • 200 - if the role exists

  • 404 - if no role exists with the given ID

Return: database representation of the matching role

Sample 200 Response Body:

{
 "display_name": "Super Users",
 "description": "Role indicates users with admin privileges",
 "_ns": "roles",
 "_href": "/pulp/api/v2/roles/super-users/",
 "users": [
   "admin"
 ],
 "_id": {
   "$oid": "502ca7afe5e7106ef1000007"
 },
 "id": "super-users",
 "permissions": {
   "/": [
     "CREATE",
     "READ",
     "UPDATE",
     "DELETE",
     "EXECUTE"
   ]
 }
}

Retrieve All Roles

Returns information on all the roles. An empty array is returned in the case where there are no roles.

Method: GET
Path: /pulp/api/v2/roles/
Permission: read
Query Parameters:
Response Codes:
  • 200 - containing the array of roles

Return: the same format as retrieving a single role, except the base of the return value is an array of them

Sample 200 Response Body:

[
 {
   "display_name": "Super Users",
   "description": "Role indicates users with admin privileges",
   "_ns": "roles",
   "_href": "/pulp/api/v2/roles/super-users/",
   "users": [
     "admin"
   ],
   "_id": {
     "$oid": "502ca7afe5e7106ef1000007"
   },
   "id": "super-users",
   "permissions": {
     "/": [
       "CREATE",
       "READ",
       "UPDATE",
       "DELETE",
       "EXECUTE"
     ]
   }
 },
 {
   "display_name": "test",
   "description": "foo",
   "_ns": "roles",
   "_href": "/pulp/api/v2/roles/test-role1/",
   "users": [
     "test-login"
   ],
   "_id": {
     "$oid": "502caa28e5e71073ae000017"
   },
   "id": "test-role1",
   "permissions": {}
 }
]