Add conditions in Bulk create workflow API payload

I am using the new Jira Bulk create workflow API. I want to add conditions in API payload but the documentation does not provide clear info. on this.
Condition I want to add:

{
  conditions: {
    conditions: [
      {
        type: "AllowOnlyReporter",
      },
      {
        type: "UserInGroupCondition",
        configuration: {
          group: "atlassian-addons-admin",
        },
      },
    ],
    operator: "OR",
  },
}

Can someone help how can I add condition in bulk create workflow API?

Hello @SagarGujarati

Your request example appears to have the wrong structure.

As per the documentation, conditions are child objects of transitions, which in turn are child objects of workflows, neither of which are defined in your request body. Next, within the lower conditions array object array, there are three possible sub-objects: id, parameter and ruleKey (required), none of which appear in your request:

Hi @sunnyape The sample payload I provided was as per old API which is deprecated.
I wanted to know what goes in the parameters, ruleKey etc. if I want to add the condition that I mentioned using the new create workflow API.

In that case, I suggest you have a look at the examples shown in the Get available workflow capabilities section of the documentation. It has a whole section for conditions and provides a number of examples of what response would be expected for different conditions, including example ruleKeys and all the values allowed for the parameters object for that rule type.

I haven’t used the new Bulk Create Workflows endpoint yet myself, so have no detailed knowledge or step-by-step instruction to pass on to you, so I can only suggest you start with the classic ‘Experiment yourself and learn as you go’ method.

For example, given that ruleKey is the only required object you must provide, why not just start with that only, then do some experiments by gradually adding some parameters and then looking at the resulting condition that is created in the workflow’s transition.

Have fun.

1 Like

I know it’s quite a complicated API.

One of the easiest ways to explore this one is to set up workflows using the older workflow designer. Then use the bulk get workflows API to fetch them to see how they behave.

Now, we haven’t quite found a great space to put all the documentation around the rules, so for now they sit under:

Just note that you will encounter some interesting behaviour between the old workflow designer and the API. This is because the API is a bit ahead of the new workflow editor user experience. So you will find that some of the new rule types aggregate several rules together and perform some optimisations with condition grouping. I want to call it out as it may surprise you as you compare conditions in designer against the conditions being returned in the new API.