How to create a Discovery profile using REST API

Document ID : KB000035754
Last Modified Date : 14/02/2018
Show Technical Document Details

Problem :

Create a discovery profile using REST client responds with a Error 500.

<ValidationError>
<ErrorCode>500</ErrorCode>
<Message>Tenant is not specified for IP domain 809.</Message>
</ValidationError> 

Steps to reproduce :

After a look at the API documentation in order to find the correct URL and XML code to POST through REST.

1) The API documentation says: 

       Creates an item of the specified type with the provided values.
       URL: http://hostname:8581/rest/discoveryprofiles/
       HTTP method = POST
       XSD for provided XML: http://hostname:8581/rest/discoveryprofiles/xsd/create.xsd 

2)   Open the REST client and perform a POST operation using the above URL (ttp://hostname:8581/rest/discoveryprofiles/)
      Use the following XML code inside the PAYLOAD of the request. 

       <DiscoveryProfile version="1.0.0">
          <ActivationStatus>true</ActivationStatus>
          <IcmpDiscoveryEnabled>true</IcmpDiscoveryEnabled>
          <IPListList>
             <IPList>xx.xx.xx.x</IPList>
          </IPListList>
          <DeviceNameRankingList>
             <DeviceNameRanking>{http://im.ca.com/inventory}ManageableDevice.SystemName</DeviceNameRanking>
             <DeviceNameRanking>{http://im.ca.com/inventory}Device.HostName</DeviceNameRanking>
             <DeviceNameRanking>{http://im.ca.com/inventory}Device.PrimaryIPAddress</DeviceNameRanking>
          </DeviceNameRankingList>
          <Item version="1.0.0">
          <Name>TEST</Name>
          </Item>
          <IPDomainMember version="1.0.0">
          <IPDomainID><IPDomainID></IPDomainID>
          </IPDomainMember>
          </DiscoveryProfile> 

Environment :
CA-Performance Management 2.3.4 /2.3.5
Linux

Resolution :
The URL must contain the tenantID, as the following sample ../rest/tenant/<tenantID>/discoverprofiles

It is important to know what ID the tenant has and also the IPDomain.
IPDoman: /rest/ipdomains
Tenants: /rest/tenants 

To get the Tenant ID use the following url in the Browser:
http://<pc-server>:8181/pc/center/webservice/tenants
- shows a list of the known tenants with detailed information.
http://<pc-server>:8181/pc/center/webservice/domains
- shows a list of the known domains with detailed information.