Retrieving of Product Hierarchy
You can use this API to retrieve the product hierarchy for a given product in JSON array.
|
API |
Signature |
|---|---|
| getProductStructure |
webService static Apttus_Config2.CPQAdminStruct.HierarchyResponseDO getProductStructure(Apttus_Config2.CPQAdminStruct.HierarchyRequestDO hierarchyRequestDO) |
|
Request Parameter |
||
|---|---|---|
|
Name |
Type |
Description |
| hierarchyRequestDO | Apttus_Config2.CPQAdminStruct.HierarchyRequestDO |
The hierarchy request data object. |
|
Request Data Object - Apttus_Config2.CPQAdminStruct.HierarchyRequestDO |
||
|---|---|---|
|
Name |
Type |
Description |
| ProductId | Id |
The Id of the product for which you want to retrieve hierarchy. |
|
Response Parameter - Apttus_Config2.CPQAdminStruct.HierarchyResponseDO |
||
|---|---|---|
|
Field |
Type |
Description |
|
ProductStructureJSONs |
List<Apttus_Config2.CPQAdminStruct.MapDO> |
The product hierarchy structure in JSON format. |
| Success | Boolean |
Indicates whether building hierarchy was successful or not. |
|
Response Data Object - Apttus_Config2.CPQAdminStruct.MapDO |
||
|---|---|---|
|
Field |
Type |
Description |
| String | Key |
The Id of the product. |
| String | Value |
The value refers to the JSON string of the product tree. |
Code Sample
The below sample code returns the product hierarchy for the given product in JSON array.
//The below method returns the entire product hierarchy for the given product in JSON Array
public List<Apttus_Config2.CPQAdminStruct.MapDO> getProductStructure(String productName)
{
Product2 bundleProduct = [SELECT Id, Name
FROM Product2
WHERE Name = :productName
LIMIT 1];
Apttus_Config2.CPQAdminStruct.HierarchyRequestDO request = new Apttus_Config2.CPQAdminStruct.HierarchyRequestDO();
request.ProductIds.add(bundleProduct.Id);
Apttus_Config2.CPQAdminStruct.HierarchyResponseDO response = Apttus_Config2.CPQAdminWebService.getProductStructure(request);
return(response != null && response.ProductStructureJSONs.size() > 0 ? response.ProductStructureJSONs : null);
}
