Modify Jira filter access rights using Python API

I’m working with the Jira Python API and I’ve run into a problem. I made a new filter with the create_filter function, but it’s set to private by default. I want to make it so other people can see and use the filter too.

I looked through the docs but couldn’t find any way to change the permissions when creating the filter. Does anyone know if there’s a method in the Jira Python API to update the filter permissions after it’s been made? Maybe something like update_filter_permissions() or set_filter_visibility()?

I tried stuff like:

jira = JIRA(options={'server': 'https://jira.example.com'})
new_filter = jira.create_filter('My Filter', 'project = PROJ')
# How to make this filter public?

Any help would be great. I’m stuck on how to make these filters accessible to the whole team. Thanks!

I’ve encountered this issue before. While the Jira Python API doesn’t offer a direct method to modify filter permissions, you can use the Jira REST API to achieve this. Here’s a quick overview of the process:

Create the filter using the Python API as you’ve done; then retrieve the filter ID by searching for it by name; finally, use the requests library to send a PUT request to update the filter’s permissions.

You’ll need to construct a JSON payload with the desired permissions and send it to the appropriate endpoint. Be sure to include your authentication details.

Keep in mind that you’ll need the necessary permissions in Jira to modify filter settings. Also, the exact permission structure may vary depending on your Jira setup and requirements.

This approach requires a bit more code, but it gives you fine-grained control over filter permissions.

hey, i ran into this too. the python api doesn’t have a direct way to change filter permissions, but you can use the jira rest api instead. after creating the filter, get its ID and then use the requests library to send a PUT request to update the permissions. you’ll need to include the right json payload with the new permissions. just make sure you have the right access in jira to do this.

I’ve faced similar challenges before. The Python API doesn’t provide an obvious method to update filter permissions, so I ended up using the Jira REST API directly. After creating the filter with the Python API, I found the filter ID by searching for the filter by name. Then, I used Python’s requests library to make a PUT request that updated the sharePermissions. In my case, I adjusted the settings so that the filter became visible to everyone in a specific project. Make sure your credentials and permissions are in order when performing these calls.