'POST /api/workflows/{encoded_workflow_id}/invocations
Schedule the workflow specified by `workflow_id` to run.'

@expose_api
def invoke(self, trans, workflow_id, payload, **kwd):

    stored_workflow = self.__get_stored_accessible_workflow(trans, workflow_id)
    workflow = stored_workflow.latest_workflow
    run_configs = build_workflow_run_configs(trans, workflow, payload)
    is_batch = payload.get('batch')
    if ((not is_batch) and (len(run_configs) != 1)):
        raise exceptions.RequestParameterInvalidException("Must    specify    'batch'    to    use    batch    parameters.")
    invocations = []
    for run_config in run_configs:
        workflow_scheduler_id = payload.get('scheduler', None)
        work_request_params = dict(scheduler=workflow_scheduler_id)
        workflow_invocation = queue_invoke(trans=trans, workflow=workflow, workflow_run_config=run_config, request_params=work_request_params)
        invocation = self.encode_all_ids(trans, workflow_invocation.to_dict(), recursive=True)
        invocations.append(invocation)
    if is_batch:
        return invocations
    else:
        return invocations[0]
