# Work Transfer

## Process transfer list
Interface Request Invoking Description <br>
HTTP Request Method: POST <br>
Request Address: http://127.0.0.1:8080/demo/horizon/workflow/rest/handwork/flow/page${suffix} <br>
**Post Data Description：**
```
{
  "accessToken": "",
  "page": "1",
  "limit": "10",
  "sort": "flowName",
  "search": ""
}

```
Request parameter description

| Parameter   | Required | Description                                                                                                                          |
|-------------|----------|--------------------------------------------------------------------------------------------------------------------------------------|
| accessToken | Yes      | Invoking interface credentials, unique user ID                                                                                       |
| page        | No       | Page number, if left blank, all data will be displayed                                                                               |
| limit       | No       | The number of data items displayed per page, if left blank, default to displaying 10 items per page                                  |
| sort        | No       | Not required. If a minus sign is added before the field, such as sort=- flowName, it will be arranged in reverse order of 'flowName' |
| search      | No       | Query process name and process type fields, default to empty, default to query all data                                              |
**Example of returned results：**
```
{
  "code": 0,
  "data": [
    {
      "flowId": "test3",
      "flowName": "Newflowtest3",
      "typeName": "www"
    },
    {
      "flowId": "test",
      "flowName": "Newflowtest",
      "typeName": ""
    }
  ],
  "message": "",
  "recordsTotal": "3",
  "success": true
}
```
**Result parameter description:**

| Parameter | Type   | Description   |
|-----------|--------|---------------|
| flowId    | String | Flow id       |
| flowName  | String | Flow name     |
| typeName  | String | Flow category |

## Process handover operation
Interface Request Invoking Description <br>
HTTP Request Method: POST <br>
Request Address: http://127.0.0.1:8080/demo/horizon/workflow/rest/handwork/flow/action${suffix} <br>
**Post Data Description：**
```
{
  "accessToken": "",
  "receiveUserId": "U_admin",
  "receiveUserName": "Admin",
  "flowId": "test"
}
```
Request parameter description

| Parameter       | Required | Description                                                                                        |
|-----------------|----------|----------------------------------------------------------------------------------------------------|
| accessToken     | Yes      | Invoking interface credentials, unique user ID                                                     |
| receiveUserId   | Yes      | Receiving User ID                                                                                  |
| receiveUserName | Yes      | Receiving User name                                                                                |
| agentName       | Yes      | Agent name                                                                                         |
| flowId          | Yes      | Process ID, if multiple processes are selected, separated by semicolons , such as flowId1; FlowId2 |
**Example of returned results：**
```
{
  "success": true,
  "code": 0,
  "message": ""
}
```

## To-do transfer list
Interface Request Invoking Description <br>
HTTP Request Method: POST <br>
Request Address: http://127.0.0.1:8080/demo/horizon/workflow/rest/handwork/item/page${suffix} <br>
**Post Data Description：**
```
{
  "accessToken": "",
  "page": "1",
  "limit": "10",
  "sort": "flowName"
}
```
Request parameter description

| Parameter   | Required | Description                                                                                                                          |
|-------------|----------|--------------------------------------------------------------------------------------------------------------------------------------|
| accessToken | Yes      | Invoking interface credentials, unique user ID                                                                                       |
| page        | No       | Page number, if left blank, default to displaying 10 items per page                                                                  |
| limit       | No       | The number of data items displayed per page, if left blank, default to displaying 10 items per page                                  |
| sort        | No       | Not required. If a minus sign is added before the field, such as sort=- flowName, it will be arranged in reverse order of 'flowName' |
**Example of returned results：**
```
{
  "code": 0,
  "data": [
    {
      "flowId": "test",
      "flowName": "Newflowtest",
      "id": "HZ28858f80bb94640180bc38f79100dc",
      "startTime": "2022-05-13 15:01:31",
      "subjectionId": "HZ28821856ef63420156ef63429c0000",
      "subjectionType": "D",
      "title": "Newflowtest",
      "trackId": "HZ28858f80bb94640180bc38f79100dd",
      "workId": "HZ28858f80bb94640180bc38f79100dc"
    }
  ],
  "message": "",
  "recordsTotal": "1",
  "success": true
}
```
**Result parameter description:**

| Parameter      | Type   | Description                                          |
|----------------|--------|------------------------------------------------------|
| flowId         | String | Flow ID                                              |
| flowName       | String | Flow name                                            |
| id             | String | Hand over  ID                                        |
| startTime      | String | Time of instance launched, format：yyyy-MM-ddHH:mm:ss |
| subjectionType | String | Organization name of sender                          |
| subjectionId   | String | Organization ID of sender                            |
| title          | String | Title of to-do                                       |
| workId         | String | Instance id                                          |
| trackId        | String | Track id                                             |

## Hand over operation
Interface Request Invoking Description <br>
HTTP Request Method: POST <br>
Request Address: http://127.0.0.1:8080/demo/horizon/workflow/rest/handwork/item/action${suffix} <br>
**Post Data Description：**
```
{
  "accessToken": "",
  "receiveUserId": "U_admin",
  "receiveUserName": "Admn",
  "dataId": "HZ28858f80bc4df60180bc5481f90012",
  "trackId": "HZ28858f80bc4df60180bc5481f90013",
  "subjectionType": "D",
  "subjectionId": "HZ28821856ef63420156ef6342a20001"
}
```
Request parameter description

| Parameter       | Required | Description                                                                                                                                     |
|-----------------|----------|-------------------------------------------------------------------------------------------------------------------------------------------------|
| accessToken     | Yes      | Invoking interface credentials, unique user ID                                                                                                  |
| receiveUserId   | Yes      | Receiving user ID                                                                                                                               |
| receiveUserName | Yes      | Receiving user name                                                                                                                             |
| dataId          | Yes      | The instance ID of the to-do handover list was returned in the previous rest interface, multiple items of data need be separated by semicolons. |
| trackId         | Yes      | Track Id of to-do work, separated by semicolons between multiple items of data                                                                  |
| subjectionType  | No       | Organization name of sender                                                                                                                     |
| subjectionId    | No       | Organization ID of sender                                                                                                                       |
**Example of returned results：**
```
{
  "code": 0,
  "message": "Operation completed！",
  "success": true
}
```

## Transfer in process|Received|Rejected List
Interface Request Invoking Description <br>
HTTP Request Method: POST <br>
Request Address: http://127.0.0.1:8080/demo/horizon/workflow/rest/handwork/page${suffix} <br>
**Post Data Description：**
```
{
  "accessToken": "",
  "requestType": "",
  "page": "1",
  "limit": "10",
  "sort": "flowName"
}
```
Request parameter description

| Parameter   | Required | Description                                                                                                                                                                   |
|-------------|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| accessToken | Yes      | Invoking interface credentials, unique user ID                                                                                                                                |
| requestType | Yes      | 'Transfer in process' represents the list being transferred, 'Received' represents the list received during transfer, 'Rejected' represents the list rejected during transfer |
| page        | No       | Page number, if left blank, all data will be displayed                                                                                                                        |
| limit       | No       | Number of data displayed per page, default to 10 displayed per page                                                                                                           |
| sort        | No       | Sorting, defaults to positive order. If a minus sign is added before a field, such as sort=- flowName, it is arranged in reverse order according to 'flowName'                |
**Example of returned results：**
```
{
  "code": 0,
  "data": [
    {
      "doTime": "2022-05-13 16:58:09",
      "flowId": "test",
      "id": "HZ28858f80bca0a3380bca2c0e6779844",
      "flowName": "Newflowtest",
      "newName": "User01",
      "newUser": "HZ28821856ef63420156ef6342a20002",
      "oldName": "Admin",
      "oldUser": "admin",
      "startTime": "2022-05-13 16:57:04",
      "title": "Newflowtest",
      "trackId": "HZ28858f80bca0a30180bca2c0e60006",
      "workId": "HZ28858f80bca0a30180bca2c0e40005"
    }
  ],
  "message": "",
  "recordsTotal": "1",
  "success": true
}
```
**Result parameter description:**

| Parameter | Type   | Description                                           |
|-----------|--------|-------------------------------------------------------|
| doTime    | String | Received time,format：yyyy-MM-dd HH:mm:ss              |
| flowId    | String | Flow ID                                               |
| id        | String | Hand over ID                                          |
| flowName  | String | Flow name                                             |
| newName   | String | Recipient user name                                   |
| newUser   | String | Recipient user ID                                     |
| oldName   | String | User name of transferor                               |
| oldUser   | String | User ID of transferor                                 |
| startTime | String | Time of instance launched, format：yyyy-MM-dd HH:mm:ss |
| title     | String | Flow title                                            |
| trackId   | String | Track ID                                              |
| workId    | String | Instance ID                                           |

## Cancellation and re-handover operations in the rejected list
Interface Request Invoking Description <br>
Cancel and re-transfer the rejected list data returned by the previous rest interface <br>
HTTP Request Method: POST <br>
Request Address: http://127.0.0.1:8080/demo/horizon/workflow/rest/handwork/operate/action${suffix} <br>
**Post Data Description：**
```
{
  "accessToken": "",
  "requestType": "",
  "dataId": ""
}
```
Request parameter description

| Parameter   | Required | Description                                                                                                                  |
|-------------|----------|------------------------------------------------------------------------------------------------------------------------------|
| accessToken | Yes      | Invoking interface credentials, unique user ID                                                                               |
| requestType | Yes      | CancelHandwork is the cancellation of the handover operation, and AgainHandwork is the re- handover operation                |
| dataId      | Yes      | The instance IDs of the rejected list returned by the previous rest interface, separated by semicolons between multiple IDs. |
**Example of returned results：**
```
{
  "code": 0,
  "message": "",
  "success": true
}
```

## Transfer, receive management
Interface Request Invoking Description <br>
HTTP Request Method: POST <br>
Request Address: http://127.0.0.1:8080/demo/horizon/workflow/rest/handwork/receive/manage/page${suffix} <br>
**Post Data Description：**
```
{
  "accessToken": "",
  "requestType": "",
  "page": "1",
  "limit": "10",
  "sort": "flowName"
}
```
Request parameter description

| Parameter   | Required | Description                                                                                                                                                                                                                                                                                       |
|-------------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| accessToken | Yes      | Invoking interface credentials, unique user ID                                                                                                                                                                                                                                                    |
| requestType | Yes      | 'To be received' refers to the list to be received, 'Received List' refers to the received list, 'Rejected List' refers to the rejected list, 'Transfer in process' refers to the transferring list, 'Transferred List' refers to the received list, 'Rejected List' refers to the rejected list. |
| page        | No       | Page number, if left blank, all data will be displayed .                                                                                                                                                                                                                                          |
| limit       | No       | The number of data items displayed per page, if left blank, default to displaying 10 items per page.                                                                                                                                                                                              |
| sort        | No       | Sorting, defaults to positive order. If a field is preceded by a minus sign, such as sort=- flowName, then is arranged in reverse order by flowName  .                                                                                                                                            |
**Example of returned results：**
```
{
  "code": 0,
  "data": [
    {
      "doTime": "2022-05-13 17:35:29",
      "flowId": "test",
      "flowName": "Newflowtest",
      "newName": "Admin",
      "newUser": "admin",
      "oldName": "User01",
      "oldUser": "HZ28821856ef63420156ef6342a20002",
      "startTime": "2022-05-13 17:33:58",
      "title": "Newflowtest",
      "id": "HZ28858f80bcc42a0180bcc488430018",
      "trackId": "HZ28858f80bcc42a0180bcc488430019",
      "workId": "HZ28858f80bcc42a0180bcc488430018"
    }
  ],
  "message": "",
  "recordsTotal": "1",
  "success": true
}
```
**Result parameter description:**

| Parameter | Type   | Description                                      |
|-----------|--------|--------------------------------------------------|
| doTime    | String | Instance launched time,format：yyyy-MM-ddHH:mm:ss |
| flowId    | String | Flow ID                                          |
| flowName  | String | Flow name                                        |
| newName   | String | Recipient user name                              |
| newUser   | String | Recipient user ID                                |
| oldName   | String | User name of transferor                          |
| oldUser   | String | User ID of transferor                            |
| startTime | String | Received time,format：yyyy-MM-ddHH:mm:ss          |
| title     | String | Title of to-do                                   |
| id        | String | IHandover ID                                     |
| trackId   | String | Track id                                         |
| workId    | String | Flow instance id                                 |

##  Receive and reject operations for transferring list
Interface Request Invoking Description <br>
Receive and reject operations for the return value of the previous rest interface (Transferring List) <br>
HTTP Request Method: POST <br>
Request Address: http://127.0.0.1:8080/demo/horizon/workflow/rest/handwork/manage/action${suffix} <br>
**Post Data Description：**
```
{
  "accessToken": "",
  "requestType": "",
  "dataId": ""
}
```
Request parameter description

| Parameter   | Required | Description                                                                                                            |
|-------------|----------|------------------------------------------------------------------------------------------------------------------------|
| accessToken | Yes      | Invoking interface credentials, unique user ID                                                                         |
| requestType | Yes      | 'Receive' is the receive operation, 'Reject' is the reject operation                                                   |
| dataId      | Yes      | The previous rest interface returned the value data id (Transferring List), with multiple ids separated by semicolons. |
**Example of returned results：**
```
{
  "code": 0,
  "message": "",
  "success": true,
  "data": {
    "HZ28858f80bb94640180bc38f79100dc": true
  }
}
```
**Result parameter description:**

| Parameter | Type | Description                                                                                                                                                                                                                               |
|-----------|------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| data      | Map  | When the request type is 'Reject', no parameters are returned, but when it is 'Receive', the handover data id is returned; The handover result 'value' is 'True' to indicate successful handover, and 'False' to indicate failed handover |