Lutz
12 years agoAce
REST API - determine if a message is a comment or an answer (not a solution)
Hi, I have a problem to determine if a message is a comment or an answer (not a solution) For an application which uses the REST API I want to extract threads, find out the question, the solu...
- 12 years ago
Hi Lutz,
I assume you're referring to the Q&A interaction style, in which case you’re correct, there is a distinction between answers and comments. As far as the REST API is concerned, however, they’re both replies to the root message. It’s actually the message metadata that distinguishes one type of reply from another.
You can use the “metadata/key” method on the “Message” object to determine the value of a metadata key for a particular message. The metadata key that determines whether a reply is a Q&A Answer is “qanda.answer”. So for example:
/restapi/vc/messages/id/5619/metadata/key/qanda.answer
If you receive a value of “true” then it is an answer. Otherwise, it's a comment.I hope this helps!
-Adam