Recent searches


No recent searches

Ticket comments API: filter by public property



Posted Aug 28, 2023

The API for retrieving comments doesn't allow to show only public comments. It will be nice to have such ability. Currently there may be gaps in the response of public comments because there may be some private ones in between that should be filtered out from the response.


1

3

3 comments

image avatar

Charles Nadeau

Zendesk Documentation Team

HI Denis,

You could use the "public" property of the comments in your script to filter out private comments. It might look something like this pseudo-code:

public_comments = []
for page in comments_request:
for comment in page:
if comment["public"] is True:
public_comments.append(comment)

 

 

0


Hi Charles Nadeau!

That's what I actually do right now. But it may be not a good in terms of UX. For example, there may be 20 comments returned: 3 are public and 17 are private. Hopefully it may be not visible for the end user (filtering doesn't break cursor pagination values) but could be confusing if the percentage of private comments is high

1


This would actually make an amaizing feature request to be able to just

 

<zendesk_domain>/api/v2/tickets/<ticket>/comments.json?private=false

 

to exclude the private comments. same for public=false could be implemented with a really simple DB querry change…

0


Please sign in to leave a comment.

Didn't find what you're looking for?

New post