I successfully created a JIRA search filter using the following API call:
POST /rest/api/2/filter
Everything works fine with filter creation. However, I’m trying to figure out how to automatically subscribe myself to this newly created filter through the REST API instead of doing it manually through the web interface.
I’ve been looking through the Atlassian documentation and noticed there’s a “subscriptions” property mentioned, but I can’t understand the proper syntax to use it correctly. Has anyone managed to set up automatic subscriptions when creating filters? I’m wondering if this can be done in the same API request or if I need a separate call afterwards.
Any examples or guidance would be really helpful since the documentation isn’t very clear on the exact format needed.
The documentation can be misleading regarding subscriptions; the property only retrieves existing filters, not for creating new subscriptions. After creating your filter, you’ll need to make a separate API call for subscriptions. First, obtain the filter ID from your creation response, then send a request to POST /rest/api/2/filter/{id}/subscriptions, including the necessary subscription details. Note that the schedule uses cron expressions, which can be a bit tricky. I streamlined this by creating a function that handles both calls, but it’s still two distinct API interactions.
Nope, you can’t include subscriptions directly when creating filters. That subscriptions property in the docs is read-only for the REST API. You’ll need to make a separate call after creating the filter to subscribe to it. Once your filter’s created, hit this endpoint: POST /rest/api/2/filter/{filterId}/subscriptions. Include the user and schedule info in the request body. I hit this same issue when automating filter management for our team. The two-step process is annoying but works fine. Just grab the filter ID from your creation response and use it right away for the subscription call.
totally feel ya on that! had the same issue before. gotta create the filter first, then just use the filter ID to subscribe using that separate endpoint. it’s a hassle, but it’s how it works. hang in there!