Using this API, you can update user roles by adding or removing tags and roles for the user based on the name or id. Super User or Manager role can use this API to get user details. You cannot retrieve data for other Super Users or Managers.
To get the user id to update the tag data or role data, use search API. Search API includes the role and tag data in the response assigned to the user.
To get the list of tags that can be used in the Admin API calls, use Asset Management (AM) API /qps/rest/2.0/search/am/tag/
This API uses https://qualysapi.qualys.com URL in the endpoint and uses basic authentication. Refer here to locate your platform URL.
API request
curl -n -u "USERNAME:PASSWORD"
"qualys_base_url/qps/rest/2.0/update/am/user/667353425"
Request body
<?xml version="1.0" encoding="UTF-8" ?>
<ServiceRequest>
<data>
<User>
<scopeTags>
<add>
<TagData>
<name>xxxx</name>
</TagData>
</add>
</scopeTags>
</User>
</data>
</ServiceRequest>
Response
<?xml version="1.0" encoding="UTF-8"?>
<ServiceResponse
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="qualys_base_url/qps/xsd/2.0/a
m/user.xsd">
<responseCode>SUCCESS</responseCode>
<count>1</count>
<data>
<User>
<id>667353425</id>
</User>
</data>
</ServiceResponse>
API request
curl -n -u "USERNAME:PASSWORD"
"qualys_base_url/qps/rest/2.0/update/am/user/667353425"
Request body
<?xml version="1.0" encoding="UTF-8" ?>
<ServiceRequest>
<data>
<User>
<roleList>
<add>
<RoleData><name>Reporting Reader</name></RoleData>
</add>
</roleList>
</User>
</data>
</ServiceRequest>
Response
<?xml version="1.0" encoding="UTF-8"?>
<ServiceResponse
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="qualys_base_url/qps/xsd/2.0/a
m/user.xsd">
<responseCode>SUCCESS</responseCode>
<count>1</count>
<data>
<User>
<id>667353425</id>
</User>
</data>
</ServiceResponse>
API request
curl -n -u "USERNAME:PASSWORD"
"qualys_base_url/qps/rest/2.0/update/am/user/667353425"
Request body
<?xml version="1.0" encoding="UTF-8" ?>
<ServiceRequest>
<data>
<User>
<roleList>
<add>
<RoleData><id>xxxxx</id></RoleData>
</add>
</roleList>
</User>
</data>
</ServiceRequest>
Response
<?xml version="1.0" encoding="UTF-8"?>
<ServiceResponse
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="qualys_base_url/qps/xsd/2.0/a
m/user.xsd">
<responseCode>SUCCESS</responseCode>
<count>1</count>
<data>
<User>
<id>667353425</id>
</User>
</data>
</ServiceResponse>
API request
curl -n -u "USERNAME:PASSWORD"
"qualys_base_url/qps/rest/2.0/update/am/user/667353425"
Request body
<?xml version="1.0" encoding="UTF-8" ?>
<ServiceRequest>
<data>
<User>
<roleList>
<add>
<id>xxxxx</id>
</add>
</roleList>
</User>
</data>
</ServiceRequest>
Response
<?xml version="1.0" encoding="UTF-8"?>
<ServiceResponse
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="qualys_base_url/qps/xsd/2.0/a
m/user.xsd">
<responseCode>SUCCESS</responseCode>
<count>1</count>
<data>
<User>
<id>667353425</id>
</User>
</data>
</ServiceResponse>
API request
curl -n -u "USERNAME:PASSWORD"
"qualys_base_url/qps/rest/2.0/update/am/user/667353425"
Request body
<?xml version="1.0" encoding="UTF-8" ?>
<ServiceRequest>
<data>
<User>
<roleList>
<remove>
<RoleData><name>Reporting Reader</name></RoleData>
</remove>
</roleList>
</User>
</data>
</ServiceRequest>
Response
<?xml version="1.0" encoding="UTF-8"?>
<ServiceResponse
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="qualys_base_url/qps/xsd/2.0/a
m/user.xsd">
<responseCode>SUCCESS</responseCode>
<count>1</count>
<data>
<User>
<id>667353425</id>
</User>
</data>
</ServiceResponse>
API request
curl -n -u "USERNAME:PASSWORD"
"qualys_base_url/qps/rest/2.0/update/am/user/193597948"
Request body
<?xml version="1.0" encoding="UTF-8" ?>
<ServiceRequest>
<data>
<User>
<roleList>
<remove>
<RoleData><id>4978768</name></RoleData>
</add>
</roleList>
</User>
</data>
</ServiceRequest>
Response
<?xml version="1.0" encoding="UTF-8"?>
<ServiceResponse
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="qualys_base_url/qps/xsd/2.0/a
m/user.xsd">
<responseCode>SUCCESS</responseCode>
<count>1</count>
<data>
<User>
<id>193597948</id>
</User>
</data>
</ServiceResponse>
API request
curl -n -u "USERNAME:PASSWORD"
"qualys_base_url/qps/rest/2.0/update/am/user/667353425"
Request body
<?xml version="1.0" encoding="UTF-8" ?>
<ServiceRequest>
<data>
<User>
<scopeTags>
<remove>
<TagData>
<id>120070243</id>
</TagData>
</remove>
</scopeTags>
</User>
</data>
</ServiceRequest>
Response
<?xml version="1.0" encoding="UTF-8"?>
<ServiceResponse
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="qualys_base_url/qps/xsd/2.0/a
m/user.xsd">
<responseCode>SUCCESS</responseCode>
<count>1</count>
<data>
<User>
<id>667353425</id>
</User>
</data>
</ServiceResponse>
API request
curl -n -u "USERNAME:PASSWORD"
"qualys_base_url/qps/rest/2.0/update/am/user/667353425"
Request body
<?xml version="1.0" encoding="UTF-8" ?>
<ServiceRequest>
<data>
<User>
<scopeTags>
<remove>
<TagData>
<name>test-1</name>
</TagData>
</remove>
</scopeTags>
</User>
</data>
</ServiceRequest>
Response
<?xml version="1.0" encoding="UTF-8"?>
<ServiceResponse
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="qualys_base_url/qps/xsd/2.0/a
m/user.xsd">
<responseCode>SUCCESS</responseCode>
<count>1</count>
<data>
<User>
<id>xxxxxxxx</id>
</User>
</data>
</ServiceResponse>