POST api/v2/Users/{id}/UserRoles

Adds an existing Role to an existing User. Returns Success/Error code plus primary key of UserRole entry made.

Request Information

URI Parameters

NameDescriptionTypeAdditional information
id

string

None.

Body Parameters

AddUserRoleViewModel
NameDescriptionTypeAdditional information
UserId

Required: Represents the PK of an existing User

globally unique identifier

None.

RoleId

Required: Represents the PK of an existing Role. Retrieve possible values from /Role/GetAllRoles

integer

None.

RoleScopeTypeId

Required: Represents the type of scope that limits the Role. Retrieve possible values from /Role/GetAllRoleScopeTypes

integer

None.

RoleScopeId

Required: Represents the PK of the entity used to limit the Role based on RoleScopeTypeId

globally unique identifier

None.

Request Formats

application/json, text/json

Sample:
{
  "UserId": "582ead43-ed91-4b85-8896-8662f93239e0",
  "RoleId": 2,
  "RoleScopeTypeId": 3,
  "RoleScopeId": "b7c0a9fa-6c08-4a48-8717-79868f5d3178"
}

application/xml, text/xml

Sample:
<AddUserRoleViewModel xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/APIWebRole.Controllers">
  <RoleId>2</RoleId>
  <RoleScopeId>b7c0a9fa-6c08-4a48-8717-79868f5d3178</RoleScopeId>
  <RoleScopeTypeId>3</RoleScopeTypeId>
  <UserId>582ead43-ed91-4b85-8896-8662f93239e0</UserId>
</AddUserRoleViewModel>

application/x-www-form-urlencoded

Sample:

Sample not available.

Response Information

Resource Description

ResultWithInt
NameDescriptionTypeAdditional information
Value

Represents the PK value that was created as a result of an add

integer

None.

ResultCode

Represents the result code

integer

None.

Description

Represents a description of the result code

string

None.

Response Formats

application/json, text/json

Sample:
{
  "Value": 1,
  "ResultCode": 2,
  "Description": "sample string 3"
}

application/xml, text/xml

Sample:
<ResultWithInt xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/APIWebRole.Controllers">
  <Description>sample string 3</Description>
  <HttpStatusCode>Continue</HttpStatusCode>
  <ResultCode>2</ResultCode>
  <Value>1</Value>
</ResultWithInt>