REST API Create workflow / task

cancel
Showing results for 
Search instead for 
Did you mean: 
d0m3n
Member II

REST API Create workflow / task

I'm using the latest Alfresco community edition (5.2 - 201707). I would like to create a task with a REST call for a group of users after I add files in repository. I can do it manually by going to: My Tasks -> Start Workflow -> Review and approve (pooled review) -> Start workflow. 

I have been searching for a way to do this but in all the confusion about versions (community, enterprise, activity, etc) I cannot be a 100% sure if a way to do this by REST exists or not. In all documentation: Alfresco Content Services REST API Explorer there is no POST method for /tasks. Although some community posts say that it should exist.

Alternatively I can user Java API. Example would be appreciated, especially regarding how to initialize connection to a local alfresco server.

Thank you for any help regarding this.

4 Replies
salaboy
Senior Member

Re: REST API Create workflow / task

Ok, I'm trying to understand your scenario, but I'm struggling to see where you are stuck. 

Can you please elaborate on: "I would like to create a task with a REST call for a group of users after I add files in repository."

It sounds like you want to extend the review workflow with an extra service task to do a rest call. This workflow is executed as part of the content repository with a version of activiti embeded in there. 

You can do a REST call or a java call depending if you want to create another Java app that points to the same DB of the content repository. In that way you should be able to interact with tasks programatically. Is that what you are looking for?

d0m3n
Member II

Re: REST API Create workflow / task

Thank you for answering. I don't think we understand each other. 

I would like to know if I can do this:

"I can do it manually by going to: My Tasks -> Start Workflow -> Review and approve (pooled review) -> Start workflow"

with a REST API call. That is create a task with attached documents assigned to a group with a REST call.

 

For example by calling POST https://api-explorer.alfresco.com/alfresco/api/-default-/public/workflow/versions/1/task with data (like description, group id, document ids, ...) in JSON format.

salaboy
Senior Member

Re: REST API Create workflow / task

yeah it is  possible to start another process from a Service Task. Do you really want to do it via a POST? because if you are in the context of the engine you can just use a Java call to do that using the RuntimeService from your Java Delegate. 

swift99
Member II

Re: REST API Create workflow / task

I can't speak for OP, but my use case is to have an external product initiate an audit/approval workflow in Alfresco in response to certain events, which will eventually be fed back into the external product as a "go/no-go" flag.