We are shifting our code from .Net - C# to REST API for Workflow TASK Approval process.
We have successfully change the update item in Workflow Task list, but Workflow not change its status using REST API Code.
$( document).ready(function() {
$.ajax({
url: "https://myonlinesite.sharepoint.com/it/_api/web/lists/GetByTitle('Workflow%20Tasks')/items/getById('4609')",
type: "POST",
data: JSON.stringify({ '__metadata': { 'type': 'SP.Data.Workflow_x0020_Tasks1ListItem' }, 'Status':'Completed', 'PercentComplete':'100','Nintex_x0020_Task_x0020_Outcomes':'Approved' }),
headers: {
"X-HTTP-Method":"PATCH",
"accept": "application/json;odata=verbose",
"content-type": "application/json;odata=verbose",
//"content-length": 1000,
"X-RequestDigest": $("#__REQUESTDIGEST").val(),
"IF-MATCH": "*"
},
beforeSend: function (XMLHttpRequest) {
XMLHttpRequest.setRequestHeader("Accept", "application/json; odata=verbose");
},
success: function (data) {
// Returning the results
console.log('success');
},
error: function (data) {
console.log(data);
}
});
});
Above script mark item as completed, but unable to reach at second approve level (not changing its state).