How to check if a list of issues is editable via REST API?

Hi,

Like the title suggest is there a way to properly check if a list of issues is editable? Currently in the app that i work in we are checking if a user has permissions to edit the issues by using the following endpoint:
/rest/api/3/permissions/check
But we have recently found that this doesn’t take into account the property “jira.issue.editable” that can be set for a particular workflow status, the only way i found to check if an issue has the “jira.issue.editable” is to check if the status on the workflow has that property, which is not very easy for multiple issues specially if they are in multiple projects.

I was wondering if there is a solution to know if a group of issues is editable by a user that takes into account both the permissions and property using the Jira Cloud REST API.

Cheers

1 Like

Hi @andre.rodrigues,

I suspect a single API call to determine this is not possible at the moment because the editability of an issue isn’t a user based permission, but rather a workflow based permission.

Can you share with me how you queried for the “jira.issue.editable” property.

Regards,
Dugald

Hi Dugald,

To query for the “jira.issue.editable” property currently i believe we need to make 3 requests:

  1. /rest/api/3/search to get the fields status and projectId for the issues we want to know the property for, with all the distinct project ids we make the request below;
  2. /rest/api/3/workflowscheme/project this endpoint gives us the workflow assigned to the projects we collected in step 1 and from here get the workflow names;
  3. /rest/api/3/workflow/search?expand=statuses.properties this endpoint gives us the workflows we collected in step 2 and using “expand=statuses.properties” we will have access to property.

I believe this is the best way to fetch the “jira.issue.editable” property, for multiple issues depending on the amount of issues/projects we should only need to make 3 requests but if we need to get the property for more than 100 issues then the number of requests starts to add up.

Another way i found to check if the issue is editable (this doesn’t query for the property) is to query the editmeta of an issue by doing, /rest/api/3/issue/TEST-1/editmeta i noticed that if the property is set to false an empty object will be returned by the endpoint, meaning we can’t edit the issue. I am not sure if this way checks both the property and the permissions plus we need to make 1 request per issue which is not possible in our case since we might have a large amount of issues.

Let me know if there is a better way to query for the “jira.issue.editable” property or if you have any other advice on this matter.

Regards,
André Rodrigues

1 Like

You can use the Jira expressions REST API to query for issue data based on a JQL query – it has a page size of 1000, so the number of requests would be reduced tenfold.

Here is an example request:

  "expression": "issues.map(i => { issueId: i.id, statusId: i.status.id, projectId: i.project.id })",
  "context": {
    "issues": {
      "jql": {
        "query": "order by id",
        "startAt": 0
      }
    }
  }
}

The response will be something like:

{
  "value": [
    {
      "issueId": 10027,
      "statusId": 10005,
      "projectId": 10006
    },
    {
      "issueId": 10028,
      "statusId": 10005,
      "projectId": 10006
    },
    ...
  ],
    "issues": {
      "jql": {
        "startAt": 0,
        "maxResults": 1000,
        "count": 1000,
        "totalCount": 4500
      }
    }
  }
}

Other than that, it’s a bit surprising that checking the issue edit permission for a particular issue doesn’t take the workflow into account. You might want to raise this is a bug in the ACJIRA project.

1 Like