Workflow REST Services

This content applies to legacy components (such as K2 Studio and K2 for Visual Studio), legacy assemblies and APIs, legacy services or other legacy functionality. These legacy items may not be available, supported, or behave as described, in future updates or versions of K2. Please see the legacy component and API support policies for more information about support for these components
The legacy Workflow REST Services described in this topic have been superseded by the Workflow REST API.

K2 provides REST-based services that can be consumed by almost any technology that is capable of interacting with the standard HTTP verbs such as GET and PUT.

The REST services are normally used in custom applications that may or may not include server-side processing (such as applications that leverage jQuery to perform client-side processing). The REST services expose the same endpoints as the Workflow WCF services, are configured the same way and support the same security and authentication mechanisms.

There are two implementations of the REST service: the standard service allows for common workflow interaction like starting a workflow, retrieving a worklist and completing tasks, while the Sync-version of the service is a lighter-weight implementation intended for lightweight client applications and batch processing.

The Workflow REST services are not necessarily enabled by default in a new K2 installation. You may need to edit the web.config file located on your K2 server (default location is noted below)
%PROGRAMFILES%\K2\WebServices\K2Services\web.config
to enable the Workflow REST services.

You can decide which of these endpoints should be exposed by editing the web.config file for the K2Services website, and enabling or disabling the endpoints in the services section. In the example below, we have disabled the REST-based Process service by commenting out the Process endpoint, highlighted in red

See the topic REST Services for additional reference and configuration information for the Workflow REST Services.
See the topic Workflow REST Services Samples for code samples illustrating how to use the Workflow REST Services.

The services are available from the K2 Workspace server (which may or may not be the same as the K2 server, depending on how your K2 environment was installed), and are accessed through URLs similar to the following:

  • http://[servername]/K2Services/REST.svc/[service path]
  • http://[servername]/K2Services/SyncREST.svc/[service path]

Notice the [service path]: since REST services are based on named resources (URIs), each workflow has a dedicated path for the methods you may want to execute. For example, when starting a workflow instance, you would send a HTTP GET request to the URL
http://k2server/k2services/REST.svc/Process/Definitions(WorkflowName)/StartInstance?


The exact path for the resource depends on the naming of the workflow you are trying to reach. See the topic URIs for REST Services for more information on the structure and use of the Service Path.

If you use client-side scripting like JavaScript, be aware of Cross-Site Scripting (XSS) security limitations.