Determine If Users, Groups, and Roles Exist

<< Click to Display Table of Contents >>

Current:  System Integration > WebAPI 

Determine If Users, Groups, and Roles Exist

Previous pageReturn to chapter overviewNext page

Supported version: 8.5.1 and later

Request address

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

Request message

Request parameter

required parameter:xmlData (required)

User:

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

<ref>

 <type>user</type>

<path>g1/u1</path>

</ref>

or

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

<ref>

<type>user</type>

 <name>u2</name>

</ref>

Group:

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

<ref>

 <type>group</type>

<path>g1/g1-1</path>

</ref>

Role:

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

<ref>

 <type>role</type>

 <path>r1</path>

</ref>

or

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

<ref>

 <type>role</type>

 <name>r1</name>

</ref>

parametric description

Parameter is node information :

1) type(required) Node type, including three types: user, group and role.

2) path(required):Node full path.

3) name(required):Node name.

Note: Only one name and path can exist.

Sample

function checkNode() {

        var xml = getXml();

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

           {xmlData : xml},

           function(result) {

           writeXml(result);

        });

     }

Response message

Response result

 

1. Successful operation

1)Get User Response

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

<results>

   <result>

       <exist>true</exist>

       <path>g1/u1</path>

   </result>

</results>

Note: When the user has multiple groups, path only displays one of them.

or

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

<results>

   <result>

       <exist>true</exist>

       <path>u2</path>

   </result>

</results>

2)Get Group Response

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

<results>

   <result>

       <exist>true</exist>

       <path>g1/g1-1</path>

   </result>

</results>

3)Get Role Response

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

<results>

   <result>

       <exist>true</exist>

       <path>r1</path>

   </result>

</results>

2. Operation failure

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

<results>

   <result>

       <exist>false</exist>

       <path></path>

   </result>

</results>

Result description

The response result information is xml, which can be parsed directly.

1) asset is the returned node information.

2) user, group, role: corresponding user, group, role information.

3) exist returns the result, true means: exists, false means: does not exist

4) path returns the path of user, group, role. If it does not exist, the path is empty.