POST/ roles

This API is used to create new user roles for your organization that are in addition to pre-existing default roles. Every user must have a role to utilize the system, and each role is comprised of one or more permissions. New roles may be necessary when identifying specialized or narrowly defined user responsibilities. Reference the permissions data model for detailed information related to available options.

Method

POST

Resource Information

Requires authentication? YES
Request formats JSON
Response formats JSON

Parameters

Parameter Label Description Type Max Length Required
id Guardian system generated unique key int N/A
name Name Role’s unique name string N/A Yes
description Description Role’s description string N/A No
permissions Permissions Represent specific actions users can perform or features users can access int N/A Yes

Example

Request Example

POST https://sandbox.perfectcompliance.com/v1/roles

{
    "name": "HR Manager",
    "description": "Testing description",
    "permissions": [
        2, 
        8, 
        19, 
        21, 
        23, 
        29
    ]
}

Response Example

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