Adding additional rows to a category using the Content Server Rest API
Looking at the included screenshot one can see plus signs to the right which is use to add addition rows for the category.
How can I use the API to add these rows instead? I.e. which API and perhaps an example if not included in the API description.
Best Answer
-
The REST API can only add rows to a Category applied to an object, not the Category subtype=131 itself. Therefore, the screenshot use case is not clear to me.
The term in the Content Server is MVA(Multi-Valued Attribute). Internally even if the category: Attribute shows a single value it is stored something like catid_versionid_attributeid={"value", "value2"} etc
{"category_id":9830,"9830_2":"new value"}
it is akin to saying apply the category called 9830 to its latest category version(implied)
Go and apply "new value" to the attributeid=2
(?func=attributes.dump is a useful RH, or select * from CatRegionMap
So the payload in that fake body you remember from last time will go as
PUT for a Category Update POST if the Category is not present api/v2/nodes/212166/categories/212936 212166 is the Document Object where the Category 212936 is being applied body: {
"212936_2": "Appu",
"212936_3": [
"my value1",
"my value2",
"my value 3",
"my value4"
] }the example in the documentation points to a Set and MVA
POST is when you want to do it the first time api/v1/nodes/212717/categories/ the api is v1 I think {
"id": 212717,
"category_id": 212936,
"212936_2": "1",
"212936_3": [
"2",
"3",
"4"
]
} Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="body"
{"id":212717,"category_id":212936,"212936_2":"1","212936_3":["2","3","4"]}
------WebKitFormBoundary7MA4YWxkTrZu0gW--1
Answers
-
The REST API can only add rows to a Category applied to an object, not the Category subtype=131 itself. Therefore, the screenshot use case is not clear to me.
The term in the Content Server is MVA(Multi-Valued Attribute). Internally even if the category: Attribute shows a single value it is stored something like catid_versionid_attributeid={"value", "value2"} etc
{"category_id":9830,"9830_2":"new value"}
it is akin to saying apply the category called 9830 to its latest category version(implied)
Go and apply "new value" to the attributeid=2
(?func=attributes.dump is a useful RH, or select * from CatRegionMap
So the payload in that fake body you remember from last time will go as
PUT for a Category Update POST if the Category is not present api/v2/nodes/212166/categories/212936 212166 is the Document Object where the Category 212936 is being applied body: {
"212936_2": "Appu",
"212936_3": [
"my value1",
"my value2",
"my value 3",
"my value4"
] }the example in the documentation points to a Set and MVA
POST is when you want to do it the first time api/v1/nodes/212717/categories/ the api is v1 I think {
"id": 212717,
"category_id": 212936,
"212936_2": "1",
"212936_3": [
"2",
"3",
"4"
]
} Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="body"
{"id":212717,"category_id":212936,"212936_2":"1","212936_3":["2","3","4"]}
------WebKitFormBoundary7MA4YWxkTrZu0gW--1 -
You may want to look at the payload using Chrome or Edge network tools and you will be able to see the payload yourself :)
Here is for a novice.
- Go to the action you want to create your code or try to understand OT's swagger(terse) documentation.
- An example is showing how to add an MVA
- Make sure you are on smartui
- Push the F12(Developer Tools) reload page if needed and clean the network tab
- Do the thing that you intended.
Click headers to see the REST API call
0 -
The normal thing when creating an integration is that you are working on the server side. But perhaps you imply that one should use Postman or similar for above?
The example in swagger/API specification, related to the array input, is of a little bit different model but understanding how to use it above makes it easier to understand that example. Though, one would need to play around with it a bit to understand it fully I believe. Though 2, that is not the model I need.
But all is good and it works.
0 -
Unfortunately, I find working in OT programming examples very difficult that is also probably because I started working with this product about 25 years ago, and while things have greatly improved OT does not have good quality fully worked examples that are very terse if you ask me. BTW REST is the easiest of things to debug because it goes through a webserver:)
I wrote this on my blog a few years back
even now people working in WF etc have huge understanding problems.OT primary has professional services so there's some vested interest as well.
0
Categories
- All Categories
- 122 Developer Announcements
- 53 Articles
- 151 General Questions
- 146 Thrust Services
- 56 OpenText Hackathon
- 35 Developer Tools
- 20.6K Analytics
- 4.2K AppWorks
- 9K Extended ECM
- 917 Cloud Fax and Notifications
- 84 Digital Asset Management
- 9.4K Documentum
- 31 eDOCS
- 179 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management
- 9 XM Fax
- Follow Categories