Add Multiple Users/Groups to A Role (Overwrite the Original Settings)

<< Click to Display Table of Contents >>

Current:  System Integration > WebAPI 

Add Multiple Users/Groups to A Role (Overwrite the Original Settings)

Previous pageReturn to chapter overviewNext page

Version: 9.1

Request address

http://ip:port/bi/api?action=setAuthorization&token=xxxx

Request message

Request parameter

required parameter:xmlData (required)

<?xml version="1.0" encoding="UTF-8"?>

<info>

 <authentication>

  <type>role</type>

  <name>test_role</name>

  <users>

 <user>

  <name>test1</name>

   </user>

   <user>

  <name>test2</name>

   </user>

  </users>

  <groups>

 <group>

  <name>group-1</name>

  <parent>managegroup</parent>

 </group>

 <group>

  <name>test_group</name>

  <parent>test_group1/test_group2</parent>

 </group>

  </groups>

 </authentication>

</info>

parametric description

The parameter is node information:

1) authentication-type (required): the node type that needs to be set, there is only one option: role.

2) authentication-name (required): Need to set the name of the node.

3) Users (optional): Need to add users to the role.

4) users-user-name (required when adding a user): Need to add the name of the user.

5) groups (optional): Need to add groups to the role.

6) groups-group-name (required when adding a group): Need to add the name of the group.

7) groups-group-parent (optional when adding a group): The path of the group needs to be added.

Explanation:

1) Fill in at least one of users and groups.

2) This method will overwrite the previous permission settings.

Sample

function setAuthentication() {

        var xml = getXml();

        $.post("http://" + ip + ":" + port + "/" + project + "/api?action=setAuthentication&token=xxxx",

           {xmlData : xml},

           function(result) {        

              writeXml(result);

           });

     }

Response message

Response result

 

1) Successful operation

<?xml version="1.0" encoding="UTF-8"?>

<results>

  <result>

         <level>1</level>

         <message>Operates successfully.</message>

  </result>

</results>

2) Operation failed

<?xml version="1.0" encoding="UTF-8"?>

<results>

 <result>

  <level>6</level>

  <message>The Users, Groups or Roles "test1" does not exist.</message>

 </result>

</results>

Result description

The response result information is xml. direct parse.

1) Level return type, different values represent different return status, see appendix.

2) Message is the interface operation result information.