I am trying to use the REST API (https://developer.opentext.com/webaccess/#url=/awd/resources/apis/cs-rest-api-for-cs-16-s#!/tklattribute&tab=501) to compile a list of all categories available on the server and all of their attributes, as is returned for: api/v2/nodes/{id}/categories/{category_id} but for a category not yet applied to a node.
I can get a list of category ids (starting with node 2006) but can't figure out how to use the category ids to get their attributes.
Is there a way to do this with the REST API?
Hi Loren,
If I recall, REST doesn't have an implementation for getting category objects, and right now, works only upon categories applied to objects, themselves.
CWS can, however, get you categories in the category volume, but perhaps the easiest thing to do would be to query the database for category information.
LiveReports may be your best bet.
If you want a quick and easy way to see all cats/atts in a given environment, log in as an administration, and run the following request handler: ?func=attributes.dump
Thanks,
Nizar
Thanks Nizar,
I am able to see the ?func=attributes.dump admin page. Is there a way to export this data without the html formatting? Possibly just as XML or JSON.
Is SQL sufficient? You could probably SELECT * FROM CatRegionMap and get relatively the same set of data in a tabulated form.
PS: Looks like I logged an FR a while back for REST to do this, if you want to request the same, open up a support ticket referencing LPAD-66089. Right now, you can get the "contents" of a category as raw node data, requiring some parsing.
SQL would work if I can run it from the REST API, how do I do that (I am not too familiar with SQL in CWS)
I see what you mean about some parsing required when getting the contents of the category node.
These two LRs (1 main and 1 Sub) will give some information as to where to pull out the Attribute definitions(Date, Integer, text, etc.)…ORACLE.
Colin J
From: eLink Entry: Content Server Development Forum <development@elinkkc.opentext.com>Sent: Wednesday, December 19, 2018 2:08 PMTo: eLink Recipient <devnull@elinkkc.opentext.com>Subject: CWS - Rest API, How to get all categories and all attributes
CWS - Rest API, How to get all categories and all attributes
Posted byloren.e.pettijohn.civ@mail.mil (Pettijohn, Loren) On 12/19/2018 04:01 PM
Quoted Nizar Ghazal on 12/19/2018 04:01 PM:
[To post a comment, use the normal reply function]
Topic:
Forum:
Content Server Development Forum
Content Server:
My Support
In REST, I believe you have to use a WebReport to retrieve the results of a LiveReport.
GET: api/v1/nodes/{id}/output where {id} is the NodeID of the WebReport that has your intended LiveReport, as a source.
It doesn't just return the raw data, however, in the JSON response, you will have each row, column and table with appropriate HTML tags.
Do you have a WebReport license?
If you haven't really used it before, my suggestion for a first go, is to create the object, click the source file browser, find your LiveReport.
It should also have a drop-down to let you select templates. Find and select the basic report, one.
Save this, and then run the report from the WebUI. What you see, is essentially what you'll receive, through REST.
Plus or minus some columns/rows, as the template only has, I think, like 5 columns setup, by default. Some additional assembly would be required.
Is CWS and Rest API two separate sets of APIs to talk to CS?
For CWS, it has DocManService.GetCategoryDefinition.
For Rest API, if Webreport is required, it has CATINFO:DEFINITION in CS16, there is no need to involve Livereport. If code in JavaScript, executeWRService can be used to call Webreport tag.
I can get a list of category ids from node but can't figure out how to use the category ids to get their attributes.
I need to somehow get a category path, e.g. "myrootcat.nextlevelcat.finalattrname" and figure out which attribute value that corresponds in the Metadata list. How do I do that? In LAPI, there was a category ID for each level of the path, and I believe I have a way of converting a category path to a final category ID. But I don't know how to find the Metadata record that corresponds to that ID. Can you help me to find a way of doing that?
LAPI used to have a concept called "CategoryVersion", but I don't see anything like that in CSWS (content server Web Services).How can I get this with the REST API?
CWS - Rest API, can't figure out how to use the category ids to get their attributes. Posted byanand.sharma@ll.mit.edu (Sharma, Anand)On 04/17/2019 02:32 PM I can get a list of category ids from node but can't figure out how to use the category ids to get their attributes.I need to somehow get a category path, e.g. "myrootcat.nextlevelcat.finalattrname" and figure out which attribute value that corresponds in the Metadata list. How do I do that? In LAPI, there was a category ID for each level of the path, and I believe I have a way of converting a category path to a final category ID. But I don't know how to find the Metadata record that corresponds to that ID. Can you help me to find a way of doing that? LAPI used to have a concept called "CategoryVersion", but I don't see anything like that in CSWS (content server Web Services).How can I get this with the REST API? [To post a comment, use the normal reply function]Topic:CWS - Rest API, How to get all categories and all attributesForum:Content Server Development ForumContent Server:My Support
Appu is strictly speaking correct. The weakness as most following this thread have already figured out is you have to have a node with a particular category on it to find any info about the category. You can't simply do a data discovery like you could in LAPI and CWS. This may be deliberate. Why make it easier for a competitor to "whack" your CS instance and "discover" every metadata definition and thus make it easier for a customer to migrate off Content Server to Sharepoint or Box or Al Fresco?
Building a WebReport however does allow you to get the complete definition of a category, which can be returned as JSON. So calling a WR from REST would satisfy that need. Now to get all the categories in the system would require a LiveReport and some SQL, probably something like select DataID, Name, from DTree where SubType=131 (or is it 133 - one is category, the other is category folder). Then you iterate the results in your WebReport using the CATINFO subtag (which is well documented).
-Hugh