Add Role

To add a new role, use the following request:

POST /roles.xml
POST /roles.json

XML Request Example

curl -i -X POST -u user:userpass -H 'Accept: application/xml' -H 'Content-type: application/xml' -d '<role><label>New_role_xml</label><permission_ids type="array"><permission_id>12</permission--_id><permission_id>14</permission--_id><permission_id>16</permission_id><permission_id>11</permission_id><permission_id>10</permission_id><permission_id>35</permission_id></permission_ids><template>admin_template</template></role>' --url http://onapp.test/roles.xml

JSON Request Example

curl -i -X POST -u user:userpass -H 'Accept: application/json' -H 'Content-type: application/json' -d '{"role":{"label":"New_role_json","permission_ids":[12,14,16,11,10,35], "template":"admin_template"}}' --url http://onapp.test/roles.json


label*  -  the new role label 

permission_ids  - the array of IDs of the permission you would like to assign to this role 

template - if the role will be based on admin_template or user_template

Page History

v. 6.4 Edge 1

  • added the template parameter