POST user/addRole?Token={Token}

The role can be assigned to the specific user. Privilege "Edit" of licensed agenda "Users" required. Privilege "Edit" of item "Roles" of agenda "Users" required. Functionality may also be restricted by record permission "Edit" of agenda "User"

Request Information

Authorization

  • Authorization by token required

Availability

  • Method disabled by configuration

URI Parameters

NameDescriptionTypeAdditional information
Token

The action is authorized by this token. Token should generated by calling action "POST login". Expiration time of each token is 20 seconds

globally unique identifier

Required

Body Parameters

UserRoleReq
NameDescriptionTypeAdditional information
LoginName

Unique identification of the user in the system

string

Required

String length: inclusive between 0 and 100

Roles

The list of all assigned roles for the specific user

Collection of RoleTo

None.

Request Formats

application/json

Sample:
{"LoginName":"John.Doo","Roles":[{"Name":"Administration"},{"Name":"CommonUser"}]}

application/xml

Sample:

<Request>
  <LoginName>John.Doo</LoginName>
  <Roles>
    <RoleTo>
      <Name>Administration</Name>
    </RoleTo>
    <RoleTo>
      <Name>CommonUser</Name>
    </RoleTo>
  </Roles>
</Request>

text/json

Sample:
{
  "LoginName": "sample string 1",
  "Roles": [
    {
      "Name": "sample string 1"
    },
    {
      "Name": "sample string 1"
    }
  ]
}

text/xml

Sample:
<Request xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <LoginName>sample string 1</LoginName>
  <Roles>
    <RoleTo>
      <Name>sample string 1</Name>
    </RoleTo>
    <RoleTo>
      <Name>sample string 1</Name>
    </RoleTo>
  </Roles>
</Request>

Response Information

Response Codes

Http CodeError NumberDescription
200 request succesfully done 0 Processed with result: {0}, OK
202 request accepted 0 Role is already assigned: {0}, OK
400 bad request 1002 Entry parameter missing or parameter bindigs failed
401 unauthorized 1000 Token {0} not found
401 unauthorized 1001 Token {0} already expired
401 unauthorized 1006 Ip filter violated for ip client address [{0}]
401 unauthorized 1007 Ip filter [{0}] parsing failed
401 unauthorized 1008 Request rate policy violated for [{0}]
403 server refuses fo fulfill the request 1408 Privilege Edit of agenda Users violated for [LoginName {0}]
403 server refuses fo fulfill the request 1405 Privilege Edit of item Roles of agenda Users violated for [LoginName {0}]
403 server refuses fo fulfill the request 1413 Record permission Edit of agenda User violated for [{0}]
404 required resource does not exist on the server 1400 User for [LoginName {0}, ID_Firma {1}] not found or it could be a system user
404 required resource does not exist on the server 1406 Role with name [{0}] not found
415 unsupported Media Type The request entity has a media type which the server or resource does not support. Only application/json and application/xml are supported
500 internal error Server exception description

Resource Description

BaseRespOfUserRoleReq
NameDescriptionTypeAdditional information
Result

RequestResult

None.

Request

UserRoleReq

None.

Response Formats

application/json

Sample:
{"Result":{"Message":"Processed with result: ExecOK","Code":0,"ModelStateErr":null},"Request":{"LoginName":"John.Doo","Roles":[{"Name":"Administration"},{"Name":"CommonUser"}]}}

application/xml

Sample:

<Response>
  <Result>
    <Message>Processed with result: ExecOK</Message>
    <Code>0</Code>
  </Result>
  <Request>
    <LoginName>John.Doo</LoginName>
    <Roles>
      <RoleTo>
        <Name>Administration</Name>
      </RoleTo>
      <RoleTo>
        <Name>CommonUser</Name>
      </RoleTo>
    </Roles>
  </Request>
</Response>

text/json

Sample:
{
  "Result": {
    "Message": "sample string 1",
    "Code": 2,
    "ModelStateErr": [
      "sample string 1",
      "sample string 2"
    ]
  },
  "Request": {
    "LoginName": "sample string 1",
    "Roles": [
      {
        "Name": "sample string 1"
      },
      {
        "Name": "sample string 1"
      }
    ]
  }
}

text/xml

Sample:
<Response xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Result>
    <Message>sample string 1</Message>
    <Code>2</Code>
    <ModelStateErr>
      <string>sample string 1</string>
      <string>sample string 2</string>
    </ModelStateErr>
  </Result>
  <Request>
    <LoginName>sample string 1</LoginName>
    <Roles>
      <RoleTo>
        <Name>sample string 1</Name>
      </RoleTo>
      <RoleTo>
        <Name>sample string 1</Name>
      </RoleTo>
    </Roles>
  </Request>
</Response>