0

I'm utilizing Bitbucket Server's REST API 1.0 to grab all activities on a pull request using the following endpoint: /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/activities.

My issue is that I'm unable to grab all of the threaded comments. Currently, I'm checking if a user has commented by grabbing the action key and seeing if it has a value of COMMMENTED. However, if there is a threaded comment then the parent comment has a comments array. If that threaded comment also has a threaded comment then there is another comments array.

What is the easiest way to grab all comments - threaded or not - on the pull request with JavaScript?

Kara Luton
  • 11
  • 2

1 Answers1

0

You didn't specify the language you use for calling the APIs but if you're in shell you can use jq to parse the json using this query to build the json object however you need

curl ... | jq '[ .. | objects | with_entries(select(.key | contains("text"))) | select(. != {}) ]'
Idan Bidani
  • 118
  • 7