Watchers self url not working within Forge

Hi @here,
Prior to submitting a bug just wanted to clarify whether it’s a bug, or just the documentation which is not updated. It is about the “watchers/watches” field in jira-rest api. According to the documentation this is the structure of the object:

"watcher": {
      "self": "https://your-domain.atlassian.net/rest/api/2/issue/EX-1/watchers",
      "isWatching": false,
      "watchCount": 1,
      "watchers": [
        {
          "self": "https://your-domain.atlassian.net/rest/api/3/user?accountId=5b10a2844c20165700ede21g",
          "accountId": "5b10a2844c20165700ede21g",
          "displayName": "Mia Krystof",
          "active": false
        }
      ]
    }

Well, this is not true, as the actual structure is:

"watches": {
      "self": "https://your-domain.atlassian.net/rest/api/2/issue/EX-1/watchers",
      "isWatching": false,
      "watchCount": 1
}

and the actual watchers are available under the “self” url. The above mentioned is not a big deal. The whole fun starts when you attempt to retrieve the “watches” in a forge app. The url turns into smth like:

"self": "https://api.atlassian.com/ex/jira/82298579-ed4f-4660-9b6d-4d341671e774/rest/api/2/issue/EX-1/watchers",

Which is also kind of fine, but first before you really call the above self url, if you do so this is what you get in response:

{
"errorMessages": [
"Issue does not exist or you do not have permission to see it."
],
"errors": {}
}

And one would think ok, adding the domain to the manifest would fix the problem. But no, no luck there.

So my question is, is it a bug? Or is it the documentation which should be updated? Or both?

Can the asApp.requestJira process absolute/full urls?

Hi @a.yessipovskiy,

When I run GET /rest/api/3/issue/{issueIdOrKey}/watchers it returns me the list of watchers. It looks like you simply don’t have any watchers so the list is not returned. Could you please ask someone to watch your issue and double check the response?

Thanks,
Vitalii

Hey @vpetrychuk ,
the watchers are there, it’s the “full” url, which is not accepted. Retrieving the watchers over the mentioned REST Entry point works fine, it’s the “self” url which is “not working”. At the moment I have implemented a work arround - I just extract the “/rest/2/issue/EX-1/watchers” part from the self and proceed with a normal request.

See the documentation for GET Issue Field: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-get
there is a watcher field mentioned, but in fact there is a “watches” field. This is what I mean with the inconsistancy in the documentation.

Oh now I see it. You are right, the docs have to be updated. I’ll report that issue.
Also parsing a self url to get a relative REST API url sounds like a reasonable solution.

Thanks,
Vitalii