I want to approve workflow through API but getting below error.
Code to approve Workflow Action:
header = {‘content-type’: ‘application/json’, ‘X-Frappe-CSRF-Token’: cookies[‘X-Frappe-CSRF-Token’]}
payload = json.dumps({‘doc’: ‘{“doctype”: “Expense Claim”, “name”: "’ + expense_id + ‘", “workflow_state”: "’+workflow_state+‘"}’,
‘action’: status})
response = requests.post(base_url + “/api/method/frappe.model.workflow.apply_workflow”, data=payload,
cookies=cookies, headers=header)
Workflow action is Approve/Rejected defined in workflow
Error:
frappe.model.workflow.WorkflowTransitionError: Not a valid Workflow Action.