Get accountId for Forge app

My Forge app has a Confluence comment added trigger set up. It then posts its own comment. I need to pull out comments that my app has added. It has its own accountId of course. How can I get this programmatically?

1 Like

You can use the get current user endpoint when called asApp.

  const app = await api
    .asApp()
    .requestConfluence(route`/wiki/rest/api/user/current`, {
      headers: {
        Accept: 'application/json',
      },
    })
    .then((res) => res.json());
3 Likes

:pray: thanks @rcsr - I was stuck looking at V2 of the API and completely missed that.

2 Likes