Fail to create workflow with field validators via REST API

Hi,

I try to copy a workflow by calling Get workflows paginated to get info of an existing workflow and then calling Create workflow.

Create workflow will works if there is no Field validator:


[{'name': 'Create', 'description': '', 'from': [], 'to': '1', 'type': 'initial', 'properties': {'jira.issue.editable': 'true', 'issueEditable': True}, 'rules': {'validators': [{'type': 'PermissionValidator', 'configuration': {'permissionKey': 'CREATE_ISSUES'}}]}}, {'name': 'Adjustment', 'description': '', 'from': [], 'to': '14022', 'type': 'global', 'properties': {'jira.issue.editable': 'true', 'issueEditable': True}, 'rules': {}}, {'name': 'Tabled', 'description': '', 'from': [], 'to': '10805', 'type': 'global', 'properties': {'jira.issue.editable': 'true', 'issueEditable': True}, 'rules': {}}, {'name': 'terminated', 'description': '', 'from': [], 'to': '14017', 'type': 'global', 'screen': {'id': '15397'}, 'properties': {'jira.issue.editable': 'true', 'issueEditable': True}, 'rules': {}}, {'name': 'pass', 'description': '', 'from': ['13891'], 'to': '6', 'type': 'directed', 'screen': {'id': '15397'}, 'properties': {'jira.issue.editable': 'true', 'issueEditable': True}, 'rules': {}}, {'name': 'start', 'description': '', 'from': ['1'], 'to': '14015', 'type': 'directed', 'properties': {'jira.issue.editable': 'true', 'issueEditable': True}, 'rules': {}}, {'name': 'need to update', 'description': '', 'from': ['13891'], 'to': '14015', 'type': 'directed', 'properties': {'jira.issue.editable': 'true', 'issueEditable': True}, 'rules': {}}, {'name': 'done', 'description': '', 'from': ['14022'], 'to': '6', 'type': 'directed', 'screen': {'id': '15397'}, 'properties': {'jira.issue.editable': 'true', 'issueEditable': True}, 'rules': {}}, {'name': 'review', 'description': '', 'from': ['14015'], 'to': '13753', 'type': 'directed', 'properties': {'jira.issue.editable': 'true', 'issueEditable': True}, 'rules': {}}, {'name': 'review pass', 'description': '', 'from': ['13753'], 'to': '6', 'type': 'directed', 'screen': {'id': '15397'}, 'properties': {'jira.issue.editable': 'true', 'issueEditable': True}, 'rules': {}}, {'name': 'need to update', 'description': '', 'from': ['13753'], 'to': '14015', 'type': 'directed', 'properties': {'jira.issue.editable': 'true', 'issueEditable': True}, 'rules': {}}, {'name': 'resume', 'description': '', 'from': ['10805'], 'to': '1', 'type': 'directed', 'properties': {'jira.issue.editable': 'true', 'issueEditable': True}, 'rules': {}}, {'name': 'final review', 'description': '', 'from': ['13753'], 'to': '13891', 'type': 'directed', 'properties': {'jira.issue.editable': 'true', 'issueEditable': True}, 'rules': {}}]

However, it will always fail when any Field Validator included:

[{'name': 'Create', 'description': '', 'from': [], 'to': '1', 'type': 'initial', 'properties': {'jira.issue.editable': 'true', 'issueEditable': True}, 'rules': {'validators': [{'type': 'PermissionValidator', 'configuration': {'permissionKey': 'CREATE_ISSUES'}}]}}, {'name': 'Adjustment', 'description': '', 'from': [], 'to': '14022', 'type': 'global', 'properties': {'jira.issue.editable': 'true', 'issueEditable': True}, 'rules': {}}, {'name': 'Tabled', 'description': '', 'from': [], 'to': '10805', 'type': 'global', 'properties': {'jira.issue.editable': 'true', 'issueEditable': True}, 'rules': {}}, {'name': 'terminated', 'description': '', 'from': [], 'to': '14017', 'type': 'global', 'screen': {'id': '15397'}, 'properties': {'jira.issue.editable': 'true', 'issueEditable': True}, 'rules': {}}, {'name': 'pass', 'description': '', 'from': ['13891'], 'to': '6', 'type': 'directed', 'screen': {'id': '15397'}, 'properties': {'jira.issue.editable': 'true', 'issueEditable': True}, 'rules': {'validators': [{'configuration': {'ignoreContext': False, 'errorMessage': '', 'fields': ['customfield_11400']}, 'type': 'FieldRequiredValidator'}]}}, {'name': 'start', 'description': '', 'from': ['1'], 'to': '14015', 'type': 'directed', 'properties': {'jira.issue.editable': 'true', 'issueEditable': True}, 'rules': {}}, {'name': 'need to update', 'description': '', 'from': ['13891'], 'to': '14015', 'type': 'directed', 'properties': {'jira.issue.editable': 'true', 'issueEditable': True}, 'rules': {}}, {'name': 'done', 'description': '', 'from': ['14022'], 'to': '6', 'type': 'directed', 'screen': {'id': '15397'}, 'properties': {'jira.issue.editable': 'true', 'issueEditable': True}, 'rules': {}}, {'name': 'review', 'description': '', 'from': ['14015'], 'to': '13753', 'type': 'directed', 'properties': {'jira.issue.editable': 'true', 'issueEditable': True}, 'rules': {}}, {'name': 'review pass', 'description': '', 'from': ['13753'], 'to': '6', 'type': 'directed', 'screen': {'id': '15397'}, 'properties': {'jira.issue.editable': 'true', 'issueEditable': True}, 'rules': {}}, {'name': 'need to update', 'description': '', 'from': ['13753'], 'to': '14015', 'type': 'directed', 'properties': {'jira.issue.editable': 'true', 'issueEditable': True}, 'rules': {}}, {'name': 'resume', 'description': '', 'from': ['10805'], 'to': '1', 'type': 'directed', 'properties': {'jira.issue.editable': 'true', 'issueEditable': True}, 'rules': {}}, {'name': 'final review', 'description': '', 'from': ['13753'], 'to': '13891', 'type': 'directed', 'properties': {'jira.issue.editable': 'true', 'issueEditable': True}, 'rules': {}}]
<Response [400]>
400 Client Error: Bad Request for url: https://jhtnaee.atlassian.net/rest/api/3/workflow

Could you please help on this?
Thanks.

Per Jira Support, remove default items from the configuration Json, then works.