cancel
Showing results for 
Search instead for 
Did you mean: 

How to call Assign-workflow webscript

dsnkostic
Champ in-the-making
Champ in-the-making
Hi,

I am trying to  start advanced workflow using assign-workflow webscript (POST /alfresco/service/slingshot/doclib/action/assign-workflow). However I don't know how to pass parameters to this script. I understand that it is a POST method (not GET). Studying code for script I found that I need ID of the workflow, NodeReference for files in workflow and usernames of assignees. I have these informations but I simply don't know how to name these parameters before posting them. For now, I am using simple HTML form with POST action to send these informations, but I guess that I am naming parameters in wrong way.

Thanks in advance,
8 REPLIES 8

mikeh
Star Contributor
Star Contributor
Most of Alfresco's REST APIs require a JSON data structure in the request body. Use something like Firebug for Firefox to see the format.

Thanks,
Mike

groberts
Champ on-the-rise
Champ on-the-rise
Did you find the right syntax ?  I have *exactly* the same question.

I guess I am going to have to build the json by trial and error by referrng to the implementing web script.

It kind of defeats the purpose of an interface if you have to look behind it to find out how to use it.  I can see the required parameters but will have to guess at the format until it works.

One tip, sorry if its obvious,  is to use Firefox Restclient to understand how to call the service before coding it in your client.

It would be great to see example json arguments with the other info about each call.

This would help people save time.

groberts
Champ on-the-rise
Champ on-the-rise
(I can't use Alfresco web client to see the json because it calls the script from within the Java Server Faces thing)

mikeh
Star Contributor
Star Contributor
Please note the /slingshot REST APIs are deliberately not documented, as they are not maintained so as to guarantee backward compatibility between versions. They are there purely to support that version of the Share client and are prone to change both parameters and output depending on Share's current requirements.

The /api namespaced webscripts are documented on the wiki.

Thanks,
Mike

groberts
Champ on-the-rise
Champ on-the-rise
Thats a useful warning Mike.  Thanks.

I could not tell from the service index that this Web Script was likely to change.   It would be worth including a caveat in slingshot scripts to warn others.

I can't see any other Web Scripts in the index that can start a simple workflow.  I need to let users of our client application assign tasks to other users,  just really to sign off documents as happens in the JSF application.  

This must be a common use case so I expect its been done several times,  I just can't see the right script. 

I've searched Jeff Pott's Alfresco Developer Guide book for a web script to assign basic workflow to people via a REST service but didn't find it.

Thanks again.

groberts
Champ on-the-rise
Champ on-the-rise
In case anybody else wants to know how to call the script mentioned above, this is what the JSON sent by share looks like

{"date":"","description":"Test","nodeRefs":["workspace://SpacesStore/f6247846-cb02-41f9-820c-089289051dd2"],"people":["admin"],"type":"wf:review"}

But as Mike says it is not likely to keep working in future releases.

mikeh
Star Contributor
Star Contributor
Indeed, I've removed that webscript (along with the create folder one) in 3.4. Share now supports both functions: Start Workflow and Create Folder via the Forms Service.

Thanks,
Mike

groberts
Champ on-the-rise
Champ on-the-rise
Mike,

Just to put things in context,  I'm using Ruby on Rails and EXT JS to write our client.   We've not got a lot of resource (who has) and so I jump at any chance to use existing components. 

Thanks for your continued work !

Guy.