1

I am trying use client-side javascript REST to work with SP.WorkflowServices. I haven't found much documentation on line, but I have found several useful endpoints like.

/_api/SP.WorkflowServices.WorkflowSubscriptionService.Current/EnumerateSubscriptions()
/_api/SP.WorkflowServices.WorkflowInstanceService.Current/EnumerateInstancesForSite()
/_api/SP.WorkflowServices.WorkflowSubscriptionService.Current/EnumerateSubscriptionsByList('listguid')

I figured some of this out with this msdn document and then sort of RESTifying it. Using that I've been able to get the subscriptions and instances using REST endpoints.

I want to also get all the definitions from my site, as far as I know that is the only place where it tells if it is a list or site workflow and some other publishing info that I need.

Here is the same documentatio for the WorkflowDeploymentService, and I tried following the same model with endpoints like:

/_api/SP.WorkflowServices.WorkflowDeploymentService.Current/EnumerateDescriptions()
/_api/SP.WorkflowServices.WorkflowDeploymentService/EnumerateDescriptions()

and so on without success. Does anybody know if there is a REST endpoint for this? I can do it with JSOM,

var context = SP.ClientContext.get_current();
var web = _context.get_web();
var serviceManager = SP.WorkflowServices.WorkflowServicesManager.newObject(context, web);
var _eploymentService = serviceManager.getWorkflowDeploymentService();
var definitions = deploymentService.enumerateDefinitions();

context.load(definitions);
context.executeQueryAsync();

But I would prefer to use REST since the rest of what I'm trying to do is using that approach.

1

According to Andrew Connel, Workflow is one area that the Rest interface is not complete, and using CSOM may be the only way.

http://www.andrewconnell.com/blog/sharepoint-2013-csom-vs.-rest-...-my-preference-and-why

  • He said in 2013 " ... I also can't interact with workflows via REST." But I've found several different endpoints under Services and Instance managers that work great in SP 2013 on-prem. I'm wondering if some of the CUs have provided that? I'm going to hold out hope that somebody knows how to get the DeploymentServices manager – Rothrock Nov 3 '17 at 15:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.