Saving a Work Item
This example shows you how to save a work item. Use the following POST request.
URI
POST /Windchill/servlet/odata/v1/Workflow/WorkItems('OR:wt.workflow.work.WorkItem:{{<workitem_id>}}')/PTC.Workflow.SaveWorkitem HTTP/1.1
You can pass the following information in the request header.
Request Headers
Content-Type: application/json
CSRF_NONCE: <Use the value from Fetch NONCE example>
Depending on what options you want to set, you can specify those options in the request body.
Request Body for Default Activity
{
"UserEventList":[],
"WorkitemComment":"Saving Workitem",
"VoteAction":"",
"AutomateFastTrack":false,
"Variables":[]
}
Request Body with Valid Routing Option
{
"UserEventList":["Accept"],
"WorkitemComment":"Saving Workitem",
"VoteAction":"",
"AutomateFastTrack":false,
"Variables":[]
}
Request Body with Valid Voting Option
{
"UserEventList":[],
"WorkitemComment":"Saving Workitem",
"VoteAction":"Do not approve",
"AutomateFastTrack":false,
"Variables":[]
}
Request Body with Variables
{
"UserEventList":[],
"WorkitemComment":"Saving Workitem",
"VoteAction":"",
"AutomateFastTrack":false,
"Variables":[{
"Name":"act3_string",
"Value":"vxcvcvxcv"
},{
"Name":"act3_int",
"Value":"1234"
},{
"Name":"act3_boolean",
"Value":"false"
},{
"Name":"act3_date",
"Value":"01/05/2019"
}]
}