javaweb-servicesopentext

How to get all OpenText Content Server categories in one call?


I'm currently on a project that involves OpenText Content Server 10.5 SP1 Update 2015-03.

I'm trying to find out if is possible to get all categories from the System Category Volume with one call using Java SOAP web services or REST.

On the web services side I found a couple of methods exposed by the DocumentManagement WSDL GetCategoryDefinition and GetCategoryDefinitions which require categoryIDs as argument.

On the REST side I managed to obtain access to categories but after a quite long trip:

  1. call to otcs/cs.exe?func=search.GetCategoryVolume gives as a response an URL for the subsequent call
  2. call to otcs/cs.exe?func=ll&ObjID=2005&objAction=XMLExport&scope=1 gives the id of the system category volume along with category IDs
  3. call to otcs/cs.exe?func=ll&ObjID=21361&objAction=XMLExport&scope=1 gives the required info about the category.

I would like to have a single call returning all information about categories I need.

Is it possible to achieve that?


Solution

  • It's possible.

    What you need to do:

    1.) Find all IDs of the Categories, you want the definitions for

    2.) call DocumentManagementWS.getCategoryDefinitions(IDs)

    example

    In my project we store all Categories in Folders, and not in the CategoryVolume of Content server.

    // INFO: variable dm is an instance of the documentManagement-Webservice
    
    // 1.) read the folder of the Categories
    Node categoryRoot = dm.getNodeByPath(configRoot.getID(), Arrays.asList("Categories"));
    
    // 2.) find all Ids of the categories
    List<Node> categories = dm.listNodes(categoryRoot.getID(), false);
    
    if (categories != null) {
        for (Node category : categories) {
            if (category.getType().equals("Category")) {
                categoryIds.add(category.getID());
            }
        }
    }
    
    // 3.) Read all defintitions of the categories
    List<AttributeGroupDefinition> categoryDefinitions = dm.getCategoryDefinitions(categoryIds);