Complete Assignment API
The Complete Assignment API allows to complete an existing open assignment. It Completes a task with all selectable options approved/rejected/completed. This API uses POST method to complete an existing open assignment.
Overview of API
Below is an overview of Start Process API:
-
It Completes a task with all selectable options i.e. approved/rejected/completed. Comments can also be provided while completing the task with following options:
-
By Task ID.
-
By providing processID and task name. In case of multiple open tasks found for this task name then any one will be completed.
-
-
API supports workflow task property "Require Review" which means a task cannot be completed if its corresponding document is not reviewed yet.
-
A task cannot be set to be reviewed from APIs.
-
For "Excel workflow" an updated excel file can be provided .
-
API supports workflow task "AllowReplacement" property. i.e. if this property is true only then the excel file will be accepted else API will throw an error.
-
The Excel file should belong to this task process solution, library and App.
-
-
For Form workflow form data can be provided.
-
Form data should be in JSON format. Also for non-repeating form fields, the API will update the only provided fields in form (if any field is not provided then its existing form value will retain) and if repeating table data is provided in JSON then existing Form's table data will be completely overwritten with new data.
-
Field rules, View rules etc will not be triggered when updating Form fields data; so the calling system must ensure to send valid form data.
-
Form data in XML format is not supported.
-
-
Attachments or supporting documents are not supported for this API.
Request and Response body
This API is used to complete an existing open assignment with following format for Request and response:
Request Data Contract:
Name | Type | Restriction | Description |
---|---|---|---|
AssignmentId | guid | - | Id of assignment to be completed. Either AssignmentId should be provided or both AssignmentName and ProcessId should be provided. |
FileContent | byte[] | - | Required for Excel Workflow task. This includes excel data file to be updated with task completion. |
Decision | string | Required | User decision status which can be Rejected/ Approved/ Complete. |
Note | string | - | Comments of assignment. |
TeamspaceId | guid | - | App id. |
ProcessId | guid | - |
Process id of the task. AssignmentName must be provided with this property. Either AssignmentId should be provided or both AssignmentName and ProcessId should be provided. |
AssignmentName | string | - |
Name of the task. ProcessId must be provided with this property. Either AssignmentId should be provided or both AssignmentName and ProcessId should be provided. |
Formfields | JSON | - | Form data in JSON format. |
Response Data Contract:
Name | Type | Restriction | Description |
---|---|---|---|
status | Boolean | True(for success), False(in case of error). |
Request and Response sample
Following samples illustrates the use of API.
Sample 1
Route: http://cha-en-vstwp418:8090/svr/api/v1/Processextn/CompleteAssignment
Request PayLoad
{
"FileContent" : null,
"Decision": "Approved",
"Note": "Completed through PE",
"AssignmentId": "07b25c54-d862-4270-af32-4654b321b3d7",
"Formfields":
{
"my:myFields":
{
"my:field_1": "test_new1",
"my:field_2": "test_new2",
"my:Repeating_Table_2":
{
"my:Repeating_Content":
{
"my:field_3": "R1_activity",
"my:field_4": "R2_activity"
}
}
}
}
}
Response payload
-
When task action (i.e. complete/approve/reject) gets completed successfully:
True
-
For already task completed:
[{"ErrorCode":"Task Process Already Completed","Message":"Task Process Already Completed","errorPrameters":[]}]
-
When given assignment id not found
[{"ErrorCode":"InvalidAssignment_AssignmentReassigned","Message":"Invalid assignment id: 2ffdba51-2f93-4502-b07e-02972ec8d1fa","errorPrameters":[]}]
Sample 2
Route: http://cha-en-vstwp418:8090/svr/api/v1/Processextn/CompleteAssignment
Request PayLoad
{
"FileContent" : null,
"Decision": "Approved",
"Note": "Completed through PE",
"ProcessId": "07b25c54-d862-4270-af32-4654b321b3d7",
"AssignmentName": "Activity 3",
"Formfields":
{
"my:myFields":
{
"my:field_1": "test_new1",
"my:field_2": "test_new2",
"my:Repeating_Table_2":
{
"my:Repeating_Content":
{
"my:field_3": "R1_activity",
"my:field_4": "R2_activity"
}
}
}
}
}
Error Sample in case user by mistake makes a GET call instead of POST call:
{
"Message": "The requested resource does not support http method 'GET'."
}
Error sample in case of wrong Assignment ID is mentioned:
[{"ErrorCode":"InvalidAssignment_AssignmentReassigned","Message":"Invalid assignment id: 07b25c54-d862-4270-af32-4654b321b3d7","errorPrameters":[]}]