Solved

Why does the API only show the last reply for each comment thread?

  • 27 January 2023
  • 6 replies
  • 50 views

Userlevel 1

I made a GET call to https://api.getguru.com/api/v1/cards/{cardId}/comments, but when I look through the returned data, it only goes one reply deep AND it only shows the most recent reply in a comment thread, even though there might be 3 replies total.

Am I doing something wrong? Is there a different API call I need to make to get all replies?

icon

Best answer by Joe Duffy 27 January 2023, 15:07

View original

This topic has been closed for comments

6 replies

Userlevel 3
Badge

Hey @Craig Lloyd  👋

Apologies for the confusion here. There is a separate endpoint that you need to call to get all replies to a particular comment. Here it is:

GET https://api.getguru.com/api/v1/cards/{cardId}/comments/{commentId}/replies

We’ll be sure to update our documentation to reflect this soon.

In the meantime, happy building!

Userlevel 1

Thank you, @Joe Duffy! Is there a way to get the replies from multiple comments in one call? Or do you have to make separate API calls for each comment?

Userlevel 3
Badge

@Craig Lloyd Glad this helps! You’ll have to loop through the comment ID’s that come back through the /api/v1/cards/{cardId}/comments endpoint and pass the comment ID to the /api/v1/cards/{cardId}/comments/{commentId}/replies endpoint.

Userlevel 1

Hey @Joe Duffy! Sorry to revive this thread again. I was finally able to try the endpoint to grab replies from a comment, but I’m getting this:

"description" : "Comment does not belong to specified Card"

I’ve double-checked that the comment id goes with the card id, and even tried different cards, but having no luck.

Userlevel 3
Badge

Hey @Craig Lloyd - going to send you a private message to ask for some more detail so I can look into this!

Userlevel 3
Badge

Closing the loop here for the sake of visibility - Craig and I chatted privately and resolved this issue. Users will need to pass the long ID’s for both the card and the comment in their call to the endpoint below:

/api/v1/cards/{cardId}/comments/{commentId}/replies

For example, your call should look like this:

/api/v1/cards/cccccccc-cccc-cccc-cccc-cccccccccccc/comments/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/replies

Instead of this:

/api/v1/cards/PNw6YMs1/comments/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/replies