Assistance on Get Comments (Forge API)

Hi,

I’m trying to implement the Get Comments API using Forge, but I run into some weird issue where some objects are shown as “[Object”].

  const requestJiraApi = await api
      .asApp()
      .requestJira(
        route(`/rest/api/2/issue/${issueKey}/comment?fields=*all&expand=renderedBody`),
        {
          method: 'GET',
          headers: {
            'Accept': 'application/json'
          }
        }
      )
  const data = await requestJiraApi.json()

  console.log(data);

Scopes are as follows:

  scopes:
    - read:request.comment:jira-service-management
    - read:comment:jira
    - read:comment.property:jira
    - read:group:jira
    - read:project:jira
    - read:project-role:jira
    - read:user:jira
    - read:avatar:jira

Thanks!

There’s nothing wrong with the code, the “[object]” comes from the default console.log settings. You’d need to use util.inspect(), see javascript - How can I get the full object in Node.js's console.log(), rather than '[Object]'? - Stack Overflow

Hi Marc,

Yup, that solves it. Thanks!