You can use this API to retrieve the list of category Ids that are associated with the given product.

APISignature
getCategoryIdswebService static List getCategoryIds(String productId)



Request Parameter
NameTypeDescription
productIdStringThe Id product for which you want to retrieve the category.
Response Parameter
NameTypeDescription
categoryIdsListThe list of category Ids 


Code Sample

The below sample code retrieves the category associated with the given product.


public void getCategoryIDs(String productName) {
	List<ID> categoryIds;

	// retrieve the productSO
	Product2 productSO = [SELECT Id, Name 
			     		  FROM Product2
			     		  WHERE Name = :productName
			    		  LIMIT 1];

	// retrieve associated category ids
	categoryIds = Apttus_Config2.CPQAdminWebService.getCategoryIDs(productSO.Id);
	
	retrun ategoryIds;
}
CODE