Task/Items/UpdateTask

This content applies to legacy components (such as K2 Studio and K2 for Visual Studio), legacy assemblies, legacy services or legacy functionality. If you have upgraded from K2 blackpearl 4.7 to K2 Five, these items may still be available in your environment. These legacy items may not be available in new installations of K2 Five. These legacy items may also not be available, supported, or behave as described, in future updates or versions of K2. Please see the legacy component support policy for more information about support for these components.

Updates a single task with the data posted.

Only actions which have been configured to support batch processing can be updated via the Task service.  Use the Worklist service to action items that do not support batch processing.
  Value Notes
URI {Service Root URI}/Task/Items/UpdateTask
e.g.
https://api.denallix.com:443/K2Services/SyncREST.svc/Task/Items/UpdateTask
 
Method POST

This method cannot be called via URI construction in the address bar of standard browsers.  Tooling such as Fiddler or .NET code may be required to execute the POST.

Only XML requests are allowed. JSON requests will result in a 202 Status code and the task will NOT be updated.

Request Headers Authorization: Basic {encrypted token goes here}
Content-type: application/xml

Ensure that the request has at least these headers set.

  • Authorization – Basic or NTLM (Windows)
  • Content-type – application/xml
Request Body   The request body contains the UpdateTask item represented as XML.  The Task item XML returned from Task GET methods can be used as a starting point for the XML input of this POST method.  Any invalid elements or attributes will be ignored
Request Body Example <t:UpdateTask xmlns:t="http://schemas.k2.com/task/d1" xmlns:p="http://schemas.k2.com/process/d1" Action="a:Rework">
  <t:Task SerialNumber="2_24" >
    <p:ProcessDataField Name="MyProcessDataField">Some process data value</p:ProcessDataField>
    <p:ProcessXmlField Name="MyProcXmlField"><XmlDocument>Some Process XML document</XmlDocument></p:ProcessXmlField>
    <p:ActivityDataField Name="MyActDataField">Some activity data value</p:ActivityDataField>
    <p:ActivityXmlField Name="MyActXmlField"><XmlDocument>Some Activity XML document</XmlDocument></p:ActivityXmlField>
  </t:Task>
</t:UpdateTask>

 
Namespaces

The UpdateTask XML requires namespaces to be defined.

  • xmlns:t="http://schemas.k2.com/task/d1" (required): contains the task attributes and nodes
  •  xmlns:p="http://schemas.k2.com/process/d1" (optional): contains the nodes for process and activity data fields when provided
 
Elements and Attributes
  • <UpdateTask>
    • @ID (Integer, required) – The SerialNumber of the task to update
    • @Action (String, required) – the type of action to perform.  Available actions:
      • a:[ActionName] – performs the process-specific action
      • r:[FQN] – redirects a task to the user specified as a Fully Qualified Name
      • d:[FQN] – delegates a task to the user specified as a Fully Qualified Name
      • s:[Duration] –performs the system action to sleep a task based on the duration provided.
        • Duration = (>0) – sleeps the item the amount of seconds specified
        • Duration = (0) – sleeps the item indefinitely
        • Duration = (<0, e.g. -1) – wakes the item
        • Duration = {DateTime} – sleeps the item until specified date time.  Standard DateTime with time zone is supported: http://www.w3.org/TR/xmlschema11-2/#dateTime.
  • <Task> – values not present in the XML for Task GET methods are not supported in updates.
    • @SerialNumber (String, required) – the serial number of the task to update
    • @Priority (Integer) – the priority to assign to the task
    • @ProcessFolio (String) – the folio to assign to the task
    • <ProcessDataField> (XML) – the process data fields to update in XML format.  In .Net use XmlConvert.ToString to get the string value otherwise use XmlConvert.To[Type] to get the actual value.
    • <ProcessXmlField> (XML) – the process XML fields as escaped XML.  In .Net use XML objects to get the value: XmlDocument.InnerText, XmlReader.InnerText, XmlWriter.InnerText, or XDocument.Value.
    • <ActivityDataField> (XML) – the activity data fields to update in XML format.  In .Net use XmlConvert.ToString to get the string value otherwise use XmlConvert.To[Type] to get the actual value.
    • <ActivityXmlField> (XML) – the activity XML fields as escaped XML.  In .Net use XML objects to get the value: XmlDocument.InnerText, XmlReader.InnerText, XmlWriter.InnerText, or XDocument.Value.
 
Return Type

Success/Failure 

Due to the asynchronous nature of the POST, a successful call may not return anything depending on the tooling used to execute the POST
Return Example HTTP/1.1 200 OK Cache-Control: private Content-Length: 0 Server: Microsoft-IIS/7.5 X-AspNet-Version: 2.0.50727 X-Powered-By: ASP.NET X-UA-Compatible: IE=EmulateIE7 Date: Wed, 16 Feb 2011 03:01:36 GMT