# Application User Role Controller Resource

### GET /roles

Return list of roles.

Request Parameters
name | type | description
--- | --- | ---
direction | query |
filter | query |
nameLike | query |
orderBy | query |
page | query |
size | query |

Response Body
media type | data type | description
--- | --- | ---
application/json | array of AppUserRoleListRecord (JSON) | list of roles

#### Example

##### Request

    GET /roles
    Content-Type: */*
    Accept: application/json

    ...

##### Response

    HTTP/1.1 200 OK
    Content-Type: application/json

    [ { } ]

### POST /roles

Create a new role. * @param request specify role details to create

Request Body
media type | data type
--- | ---
application/json | AppUserRoleRequest (JSON)

Response Body
media type | data type | description
--- | --- | ---
application/json | AppUserRoleGuidNameDto (JSON) | details of newly created user

#### Example

##### Request

    POST /roles
    Content-Type: application/json
    Accept: application/json

    { }

##### Response

    HTTP/1.1 201 Created
    Content-Type: application/json

    { }

### DELETE /roles/{guid}

Remove role.

Request Parameters
name | type | description
--- | --- | ---
guid | path | specify local unique identifier for role (use by vProtect)

#### Example

##### Request

    DELETE /roles/{guid}
    Content-Type: */*

    ...

##### Response

    HTTP/1.1 204 No Content

### GET /roles/{guid}

Get a single role.

Request Parameters
name | type | description
--- | --- | ---
guid | path | specify local unique identifier for role (use by vProtect)

Response Body
media type | data type | description
--- | --- | ---
application/json | AppUserRoleDetailsDto (JSON) | a single role details

#### Example

##### Request

    GET /roles/{guid}
    Content-Type: */*
    Accept: application/json

    ...

##### Response

    HTTP/1.1 200 OK
    Content-Type: application/json

    { }

### PUT /roles/{guid}

Change role details.

Request Parameters
name | type | description
--- | --- | ---
guid | path |

Request Body
media type | data type | description
--- | --- | ---
application/json | AppUserRoleRequest (JSON) | specify role details to update

Response Body
media type | data type | description
--- | --- | ---
application/json | AppUserRoleGuidNameDto (JSON) | updated details of role

#### Example

##### Request

    PUT /roles/{guid}
    Content-Type: application/json
    Accept: application/json

    { }

##### Response

    HTTP/1.1 204 No Content
    Content-Type: application/json

    { }

### POST /roles/{guid}/clone

Request Parameters
name | type | description
--- | --- | ---
guid | path |

Request Body
media type | data type
--- | ---
application/json | CloneDTO (JSON)

Response Body
media type | data type | description
--- | --- | ---
application/json | AppUserRoleCloneResponseDto (JSON) |

#### Example

##### Request

    POST /roles/{guid}/clone
    Content-Type: application/json
    Accept: application/json

    { }

##### Response

    HTTP/1.1 201 Created
    Content-Type: application/json

    { }

### GET /roles/{guid}/contexts

Request Parameters
name | type | description
--- | --- | ---
guid | path |

Response Body
media type | data type | description
--- | --- | ---
application/json | array of PrivilegeContextRoleRecordDto (JSON) |

#### Example

##### Request

    GET /roles/{guid}/contexts
    Content-Type: */*
    Accept: application/json

    ...

##### Response

    HTTP/1.1 200 OK
    Content-Type: application/json

    [ { } ]

### PUT /roles/{guid}/contexts/add

Add context to role

Request Parameters
name | type | description
--- | --- | ---
guid | path | specify role guid

Request Body
media type | data type | description
--- | --- | ---
application/json | LegacyPrivilegeContextRequest (JSON) | specify privilege request to be added to role

Response Body
media type | data type | description
--- | --- | ---
application/json | PrivilegeContextCreationResponseDto (JSON) | updated details of role

#### Example

##### Request

    PUT /roles/{guid}/contexts/add
    Content-Type: application/json
    Accept: application/json

    { }

##### Response

    HTTP/1.1 204 No Content
    Content-Type: application/json

    { }

### PUT /roles/{guid}/contexts/remove

Remove context from role.

Request Parameters
name | type | description
--- | --- | ---
guid | path | specify role

Request Body
media type | data type | description
--- | --- | ---
application/json | StringDTO (JSON) | specify context to remove from role

#### Example

##### Request

    PUT /roles/{guid}/contexts/remove
    Content-Type: application/json

    { }

##### Response

    HTTP/1.1 204 No Content

### PUT /roles/{guid}/privileges/add

Add context to role

Request Parameters
name | type | description
--- | --- | ---
guid | path | specify role guid

Request Body
media type | data type | description
--- | --- | ---
application/json | StringDTO (JSON) | specify dto with privilege to add to role

#### Example

##### Request

    PUT /roles/{guid}/privileges/add
    Content-Type: application/json

    { }

##### Response

    HTTP/1.1 204 No Content

### PUT /roles/{guid}/privileges/remove

Add context to role

Request Parameters
name | type | description
--- | --- | ---
guid | path | specify role guid

Request Body
media type | data type | description
--- | --- | ---
application/json | StringDTO (JSON) | specify dto with privilege to remove from role

#### Example

##### Request

    PUT /roles/{guid}/privileges/remove
    Content-Type: application/json

    { }

##### Response

    HTTP/1.1 204 No Content