Using REST to create a new user with a user group on a DSS environment
search cancel

Using REST to create a new user with a user group on a DSS environment


Article ID: 260987


Updated On:


CA Spectrum


We would like to create a new user in a DSS environment using REST.  However we see errors "already exists" when we try to create the user.


The following message is expected from Spectrum:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<create-model-response xmlns="" error="AlreadyExists">
  <model mh="0xa873b6"/>


Release : 21.2.x / 22.2.x


When creating a user in a DSS environment under a user group, you need to have the domain id of the User Group included (converted to hex) in the query.


The first query is returning model_handle and DomainID (Landscape Handle) of the user-group.
               You will need to use these values and create the user under the user-group.
               As an example :
STEP-1 : Fetching the Model_Handle and DomainID of the User-Group Administrator:
POST https://<ONECLICK HOSTNAME>:<port>/spectrum/restful/servicesinfo/serviceslist/spectrum/restful/models
<rs:model-request throttlesize="500"
  xsi:schemaLocation=" ../../../xsd/Request.xsd">
        <rs:search-criteria xmlns="">
                    <attribute id="AttributeID.MTYPE_HANDLE">
                        <value>0x1040a</value>  <!--UserGroup -->
                    <attribute id="0x1006e">    <!--Model_Name -->
    <rs:requested-attribute id="0x129fa" /> <!--Model Handle --> No need to fetch Home Model Handle here, just fetch its own model_handle
    <rs:requested-attribute id="0x129ac" /> <!—DomainID of the User-Group -->
<model-response-list total-models="2" throttle="2" error="EndOfResults" xmlns="">
      <model mh="0xb00068">
         <attribute id="0x129fa ">0xb00068</attribute> <!-- ModelHandle -->
         <attribute id="0x129ac">11534336</attribute> <!—DomainIDof the User-Group -->
      <model mh="0xa0007a">
         <attribute id="0x129fa ">0xa0007a</attribute> <!-- ModelHandle -->
         <attribute id="0x129ac">10485760</attribute> <!—DomainID of the User-Group -->
STEP-2: Convert the Decimal value of DomainID received above to Hexa-Decimal value
               Decimal Value: 11534336               Hexa-Decimal Value: 0xB00000
               Decimal Value: 10485760               Hexa-Decimal Value: 0xA00000
STEP-3: Create the user under Administrator group on both the landscapes with 2 separate queries

https://<ONECLICKHOSTNAME>:<port>/spectrum/restful/servicesinfo/serviceslist/spectrum/restful/model?landscapeid=0xB00000&mtypeid=0x10004&parentmh=0xb00068&relationid=0x10022&attr=0x1006e&val=spectrum <!— creates the user spectrum on domain 0xB00000  -->

POST https://<ONECLICKHOSTNAME>:<port>/spectrum/restful/servicesinfo/serviceslist/spectrum/restful/model?landscapeid=0xA00000&mtypeid=0x10004&parentmh=0xa0007a&relationid=0x10022&attr=0x1006e&val=spectrum <!— creates the user spectrum on domain 0xA00000  -->