Forum Discussion
vipaggar, You can not get all the information in one API request, but you can get most of the information using single API, like:
- Post subject
- Content
- Likes/kudos
- Views
- Last update time stamp
- Creation time stamp
You can check the API supported for this in the below documentation.- lukBoss
The closest you can probably get with API v2 is a query like this:
SELECT id, subject, body, view_href, conversation.last_post_time, current_revision.last_edit_time, author.login, author.view_href, metrics.views, kudos.sum(weight), tags.count(*), replies.count(*), popularity FROM messages WHERE depth = 0 LIMIT 10
with the information you get about tags and replies (e.g. if there are any) you could then issue the necessary API calls to fetch those objects but only if necessary.
if you want the entire conversation (e.g. a conversation with all replies), things get a bit more complicated and the easier way out is to use API v1 because it gives you the entire conversation trough it's /threads endpoints, like this
<community.url>/restapi/v1/threads/id/1223?restapi.response_format=json
there you will find a node/property called "linear", that is the entire conversation...
if you want to do it with API v2, you need to remove the depth = 0 constraint and instead figure out WHERE constraints with parent.id or ancestors.id which will then return all child messages of the parent specified and go from there...
Related Content
- 5 months ago
- 4 years ago