Please Wait...

GET/ roles

This API returns a collection of roles for your organization. It is used to identify roles available for user assignment as every user must have a role to utilize the system given the role dictates what the user may do within Guardian.

Method

GET

Resource Information

Requires authentication? YES
Response formats JSON

Parameters

Parameter Required Description
page No specifies the page number from where you want to begin accessing records

Filtering

The fields in the table below can be used in the query string of a GET request, for example:

GET https://sandbox.perfectcompliance.com/v1/employees?firstName=John

Currently, it is only possible to query for exact values (no wildcards or partial matches); however, the query criteria is case-insensitive.

Parameter Type Description
name string Role’s unique name

Example

Request Example

GET https://sandbox.perfectcompliance.com/v1/roles?page_size=5&page=1

Response Example

{
    "searchResult": [
        {
            "description": "", 
            "name": "HR Manager", 
            "id": 20
        }, 
        {
            "description": "", 
            "name": "HR Manager with E-Verify", 
            "id": 21
        }, 
        {
            "description": "", 
            "name": "Internal Auditor", 
            "id": 22
        }, 
        {
            "description": "", 
            "name": "Location Manager", 
            "id": 18
        }, 
        {
            "description": "", 
            "name": "Location Manager with E-Verify", 
            "id": 19
        }, 
        {
            "description": "", 
            "name": "Super Admin", 
            "id": 23
        }
    ], 
    "links": [
        {
            "href": "/v1/roles/",
            "rel": "self"
        },
        {
            "href": "/v1/roles/?page=1",
            "rel": "first"
        },
        {
            "href": "/v1/roles/?page=5",
            "rel": "last"
        },
        {
            "href": "/v1/roles/?page=2",
            "rel": "next"
        },
        {
            "href": "/v1/roles/?page=5",
            "rel": "previous"
        }
    ]
}

Single Record Request Example

GET https://sandbox.perfectcompliance.com/v1/roles/<role_id>

Single Record Response Example

{
    "id": 1,
    "name": "HR Manager",
    "description": "Testing description",
    "permissions": [
        2,
        8,
        19,
        21,
        23,
        29
    ],
    "links": [
        {
            "href": "/v1/roles/20/", 
            "rel": "self"
        }
    ]
}