Technical name for one attribute is different in each environment (OTAP) - How to solve this?

Options

In Content Server it is possible to define one or more 'Categories', and within each 'Category' one or more 'Attributes'. Next to the 'User Friendly' name of these attributes (such as 'DocumentNumber' or 'Organization'), these attributes also get technical names such as 'Attr_60633_2' or 'Attr_69320_3'.

When you want to query for documents via API, using these 'Attributes', I understand that you can only do that by using the 'Technical name'. However, where the attribute 'DocumentNumber' may have a technical name 'Attr_60633_2' in the 'Dev' environment, it is very likely that is has a very different technical name in de 'Test' environment. For example 'Attr_49202_2'.

This would mean that code that has been realized, will work on the 'Dev' environment, but won't work on 'Test' after it has been rolled out on 'Test'.

I have searched for a post on this forum that covers this topic, but have not found it.

My question is: is there a possibility to query these documents via API, using the 'User Friendly' names? Or is there another possibility to avoid this issue?

Comments

  • Appu Nair
    edited January 4, 2022 #2
    Options

    Most developers work around this problem. For e.g OT's categories are never redone by hand in any project so if DEv has a Category as Attr_60633_2 in this case 60633 is the catID available in catregionmap,when you import them into Next it may be Attr_80633_2 . The search regions is probably the one that holds the friendly in your new system. If this is understandable the developer writing the code in a lower system only has to keep the CategoryID in a readable configuration or even do something like reading it off catregionmap.

    Unless OT writes the code to call the API's by freindlies this will exist, unfortunately.When OT introduced the NickNames it was a good one and Ot may eventually have to do it because cloud systems may have a requirement for proper transport with no manipulation of artifacts.Some enterprise class systems forbid touching transports hence many years ago GCI created a transport to support life sciences systems to create mapping things. It can do justice to almost everything except a careless programmers code

    I have always resorted to keeping these as readable configuration files.

    One thing you may want to look is to see if you have budgets for buying Oscript wrappers like Chris Meyers RH product but I am not sure if he addresses them for use within client API's like soap or rest.Answer modules on the other hand does allow the programmer to go more OOPish like how you want.

    Some ideas I have seen and products I have seen.



    the RH ?func=Attributes.dump is a useful one that goes through catregionmap and provides the ID to Friendly including the Type used

  • there are ways of getting them dynamically, e.g. DB Query but most of us will just set them as constants for each environment in a configuration file/WebReport/DB table etc so that they are all in a single place.

    The Request Handler that @Appu Nair shared will give you all of the values, or you can just open the category (grabbing its DATA ID from the URL) and then grab the specific ATTR ID for any Attribute you need from the source code of the page.

    If you have a node with the Category applied then you can use various CWS / REST calls to load the info from the node, although the APIs are lacking currently in direct Category interactions.

  • In case you have a xECM flavor licensed, I would implement it with Unique Names.

    There are API functions available to get the value of a unique name. The transport warehouse will automatically update the value of the unique name in the target system.

    You define a Unique Name "MyCat" that refers to the category with the ID 60633.

    You program retrieves the value for the unique name "MyCat" and use that in the query.

  • Thank you for all the replies! The customer does not have an xECM license, so I think I am going with the solution to store the mapping information of friendly en technical names for the attributes. I am wondering though, whether it isn't better to store this information in memory, each time a user starts a session with Content Server. Advantage is that the data is available in memory, which is always faster than retrieving information from a configuration file, or querying it from a database table.

    What do you think?

  • It depends the CS threads already has a cached copy of all the Categories, also when CS Oscript is used the developer can use Memcached to store many things of use. None of these are available unless you cache it when you are using tools other than oscript.

  • I think that the time for querying it or reading from a config file is is very small to the time needed to make a call to CS and do a search.

    I won't bother unless something is already in place.

    I assume you are talking about caching it outside CS, in <our own application.

  • hi!

    Is there any place to check with API methods work with Unique Names?

    Mostly, i would like to now if we can create nodes with categories, using unique names to refer to the category.

  • @Israel.Garcia using OScript, and some of the APIs you can iterate through datastructures / db tables to get the unique ids from a name and then use the id to update the value, you cant just use the name directly.

  • Hi @Greg Griffiths,

    I have been searching in the API (Rest API), and I cannot find how to retrieve the unique id information by its name. Would you know what resource could do that?

    If I understard it correctly, how it works should be something like:

    You define a Unique Name "MyCat" that refers to the category with the ID 60633.

    With some API call (this is what I am looking for) I retrieve the value for the unique name "MyCat", that should give me the ID 60633, and then I can use that ID in the next calls.

    Thanks a lot for your help,

  • Appu Nair
    edited March 14, 2022 #11
    Options

    It might be easier if you implemented your logic using a WR (webreport) with the following query. Try this as an e.g. and then try to refine it to your solution.

    1. Create a LR with this query select * from CatRegionMap in your source system. When you see a field like Attr_42370_10 understand that the convention is Attr_<category DataiD>_<AttributeID> this is what you need to specify in your node operations for applying categories. The Attr_42370_1 specifies the category object itself.
    2. Create a WR with the above LR as its source and include code like [LL_REPTAG_1 /] in the ROW to what all fields you find useful .print what you need of it.
    3. Once you have what you need copy the WR and give it a Nickname.The reason why the Nickname is important i sbecause you can then call the WR Rest API endpoint like this fakeurlhttp://server/otcs/cs.exe/api/v1/webreports/MobileConnector?format=webreport&inputlabel1=BEDFORD:12100&inputlabel2=ASSET&inputlabel3=PDMaximo1 notice the use of MobileConnector it is easier than calling it with the dataid of the LR as nicknames are unique to the system and if properly transported the receiving system will get it.
    4. Use postman and call this new WR using developer.opentext.com webreport examples especially look at directives like INSERTJSON tags in WR they return valid JSON.
    5. When your solution is migrated ask the team to transport the artifacts. So all you now need is a query to return all category attributes by name.
    6. The API that Hans says is part of the XECM solution so using its api I have no idea if it is public you might be able to do the same