I'm using CS 16.2 and Postman.
The Swagger documentation for PUT (api/v1/nodes/{id}/categories/{category_id}/) says this:
Implementation Notes
Updates attributes values on the specified category and node. Use of the 'body' parameter to pass in structured JSON is recommended, where the format is body : {"[category_id]_[category attribute id]":[value], ...}
Example:
body : {"14822_2":"abc","14822_3":1234}
However, if I put a JSON in the body, it doesn't actually update anything. My sample JSON:
{
"4772314_2": "My text value",
"4772314_3": 5,
"4772314_4": "December",
"4772314_5": "2022"
}
The only way I can get this to work (so far), is if I enter values such as the below as parameters:
id: <dataID>
category_id: 4772314
4772314_2: My Text value
4772314_3: 5
4772314_4: December
Doing this will update the attributes in Content Server. It ignores whatever is in the body of the request.
A few things:
a) why do id & category_id have to be entered as query parameters when they are already in the path? (api/v1/nodes/{id}/categories/{category_id}/). It gives me a "Parameters are required for PUT, POST and PATCH methods" error if I leave out the parameters.
b) why doesn't it work if I pass the Category & Attribute info in the body instead of the parameter?
We really need better code samples for the REST API. The few code samples that we were given for CWS were great and very helpful in getting us started. With the REST API, I'm just wasting a lot of time searching through a bunch of "0 reply" threads here on the forum.