mirror of
https://github.com/apache/incubator-kie-kogito-examples.git
synced 2025-08-06 15:20:20 +08:00
[Incubator-kie-issues-1888] Updated Readme files to use new generic usertasks api (#2093)
* Updated usertasks api * Undo yarn.lock
This commit is contained in:
@ -168,12 +168,11 @@ To make use of this application it is as simple as putting a sending request to
|
||||
"country" : "US" }
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
Complete curl command can be found below:
|
||||
|
||||
```
|
||||
```sh
|
||||
curl -X POST -H 'Content-Type:application/json' -H 'Accept:application/json' -d '{"name" : "my fancy deal", "traveller" : { "firstName" : "John", "lastName" : "Doe", "email" : "jon.doe@example.com", "nationality" : "American","address" : { "street" : "main street", "city" : "Boston", "zipCode" : "10005", "country" : "US" }}}' http://localhost:8080/deals
|
||||
```
|
||||
|
||||
@ -181,38 +180,21 @@ this will then trigger the review user task that you can work.
|
||||
|
||||
### Get review task for given deal
|
||||
|
||||
First you can display all active reviews of deals
|
||||
You can display all active reviews of deals by running
|
||||
|
||||
```sh
|
||||
curl http://localhost:8080/usertasks/instance?user=john
|
||||
```
|
||||
curl -H 'Content-Type:application/json' -H 'Accept:application/json' http://localhost:8080/dealreviews
|
||||
```
|
||||
|
||||
based on the response you can select one of the reviews to see more details
|
||||
|
||||
```
|
||||
curl -H 'Content-Type:application/json' -H 'Accept:application/json' http://localhost:8080/dealreviews/{uuid}/tasks?user=john
|
||||
```
|
||||
|
||||
where uuid is the id of the deal review you want to work with.
|
||||
|
||||
Next you can get the details assigned to review user task by
|
||||
|
||||
```
|
||||
curl -H 'Content-Type:application/json' -H 'Accept:application/json' http://localhost:8080/dealreviews/{uuid}/review/{tuuid}?user=john
|
||||
```
|
||||
|
||||
where uuid is the id of the deal review and tuuid is the id of the user task you want to get
|
||||
|
||||
|
||||
### Complete review task for given deal
|
||||
|
||||
Last but not least you can complete review user task by
|
||||
|
||||
```
|
||||
curl -X POST -H 'Content-Type:application/json' -H 'Accept:application/json' -d '{"review" : "very good work"}' http://localhost:8080/dealreviews/{uuid}/review/{tuuid}?user=john
|
||||
```sh
|
||||
curl -X POST -H 'Content-Type:application/json' -H 'Accept:application/json' -d '{"transitionId":"complete","data":{"review" : "very good work"}}' http://localhost:8080/usertasks/instance/{tuuid}/transition?user=john
|
||||
```
|
||||
|
||||
where uuid is the id of the deal review and tuuid is the id of the user task you want to get
|
||||
where tuuid is the id of the user task you want to complete
|
||||
|
||||
* Review Log should look similar to
|
||||
|
||||
|
@ -165,38 +165,21 @@ this will then trigger the review user task that you can work.
|
||||
|
||||
### Get review task for given deal
|
||||
|
||||
First you can display all active reviews of deals
|
||||
You can display all active reviews of deals by running
|
||||
|
||||
```sh
|
||||
curl http://localhost:8080/usertasks/instance?user=john
|
||||
```
|
||||
curl -H 'Content-Type:application/json' -H 'Accept:application/json' http://localhost:8080/dealreviews
|
||||
```
|
||||
|
||||
based on the response you can select one of the reviews to see more details
|
||||
|
||||
```
|
||||
curl -H 'Content-Type:application/json' -H 'Accept:application/json' http://localhost:8080/dealreviews/{uuid}/tasks?user=john
|
||||
```
|
||||
|
||||
where uuid is the id of the deal review you want to work with.
|
||||
|
||||
Next you can get the details assigned to review user task by
|
||||
|
||||
```
|
||||
curl -H 'Content-Type:application/json' -H 'Accept:application/json' http://localhost:8080/dealreviews/{uuid}/review/{tuuid}?user=john
|
||||
```
|
||||
|
||||
where uuid is the id of the deal review and tuuid is the id of the user task you want to get
|
||||
|
||||
|
||||
### Complete review task for given deal
|
||||
|
||||
Last but not least you can complete review user task by
|
||||
|
||||
```
|
||||
curl -X POST -H 'Content-Type:application/json' -H 'Accept:application/json' -d '{"review" : "very good work"}' http://localhost:8080/dealreviews/{uuid}/review/{tuuid}?user=john
|
||||
```sh
|
||||
curl -X POST -H 'Content-Type:application/json' -H 'Accept:application/json' -d '{"transitionId":"complete","data":{"review" : "very good work"}}' http://localhost:8080/usertasks/instance/{tuuid}/transition?user=john
|
||||
```
|
||||
|
||||
where uuid is the id of the deal review and tuuid is the id of the user task you want to get
|
||||
where tuuid is the id of the user task you want to complete
|
||||
|
||||
* Review Log should look similar to
|
||||
|
||||
|
@ -179,38 +179,21 @@ this will then trigger the review user task that you can work with.
|
||||
|
||||
### Get review task for given deal
|
||||
|
||||
First you can display all active reviews of deals
|
||||
You can display all active reviews of deals by running
|
||||
|
||||
```sh
|
||||
curl http://localhost:8080/usertasks/instance?user=john
|
||||
```
|
||||
curl -H 'Content-Type:application/json' -H 'Accept:application/json' http://localhost:8080/dealreviews
|
||||
```
|
||||
|
||||
based on the response you can select one of the reviews to see more details
|
||||
|
||||
```
|
||||
curl -H 'Content-Type:application/json' -H 'Accept:application/json' http://localhost:8080/dealreviews/{uuid}/tasks?user=john
|
||||
```
|
||||
|
||||
where uuid is the id of the deal review you want to work with.
|
||||
|
||||
Next you can get the details assigned to review user task by
|
||||
|
||||
```
|
||||
curl -H 'Content-Type:application/json' -H 'Accept:application/json' http://localhost:8080/dealreviews/{uuid}/review/{tuuid}?user=john
|
||||
```
|
||||
|
||||
where uuid is the id of the deal review and tuuid is the id of the user task you want to get
|
||||
|
||||
|
||||
### Complete review task for given deal
|
||||
|
||||
Last but not least you can complete review user task by
|
||||
|
||||
```
|
||||
curl -X POST -H 'Content-Type:application/json' -H 'Accept:application/json' -d '{"review" : "very good work"}' http://localhost:8080/dealreviews/{uuid}/review/{tuuid}?user=john
|
||||
```sh
|
||||
curl -X POST -H 'Content-Type:application/json' -H 'Accept:application/json' -d '{"transitionId":"complete","data":{"review" : "very good work"}}' http://localhost:8080/usertasks/instance/{tuuid}/transition?user=john
|
||||
```
|
||||
|
||||
where uuid is the id of the deal review and tuuid is the id of the user task you want to get
|
||||
where tuuid is the id of the user task you want to complete
|
||||
|
||||
* Review Log should look similar to
|
||||
|
||||
|
@ -236,64 +236,50 @@ Example response:
|
||||
]
|
||||
```
|
||||
|
||||
### GET /orderItems/{id}/tasks
|
||||
### GET /usertasks/instance?user={user}
|
||||
|
||||
Getting user tasks awaiting user action
|
||||
|
||||
```sh
|
||||
curl -X GET http://localhost:8080/orderItems/66c11e3e-c211-4cee-9a07-848b5e861bc5/tasks?user=john
|
||||
curl -X GET http://localhost:8080/usertasks/instance?user=john
|
||||
```
|
||||
Example response:
|
||||
|
||||
```json
|
||||
[
|
||||
{"id":"62f1c985-d31c-4ead-9906-2fe8d05937f0","name":"Verify order"}
|
||||
{
|
||||
"id": "1dd3123a-aa2c-4b68-93c3-fd0c2abe76c8",
|
||||
"userTaskId": "UserTask_1",
|
||||
"status": {
|
||||
"terminate": null,
|
||||
"name": "Reserved"
|
||||
},
|
||||
"taskName": "Verify order",
|
||||
...
|
||||
]
|
||||
```
|
||||
|
||||
### GET /orderItems/{id}/Verify_order/{tid}
|
||||
|
||||
Getting user task details
|
||||
|
||||
```sh
|
||||
curl -X GET http://localhost:8080/orderItems/66c11e3e-c211-4cee-9a07-848b5e861bc5/Verify_order/62f1c985-d31c-4ead-9906-2fe8d05937f0?user=john
|
||||
```
|
||||
Example response:
|
||||
|
||||
```json
|
||||
{
|
||||
"id":"62f1c985-d31c-4ead-9906-2fe8d05937f0",
|
||||
"input1":
|
||||
{
|
||||
"orderNumber":"12345",
|
||||
"shipped":false,
|
||||
"total":0.537941914075738
|
||||
},
|
||||
"name":"Verify order"
|
||||
}
|
||||
```
|
||||
|
||||
### POST /orderItems/{id}/Verify_order/{tid}
|
||||
### POST /usertasks/instance/{taskId}/transition?user={user}
|
||||
|
||||
Complete user task
|
||||
|
||||
```sh
|
||||
curl -d '{}' -H "Content-Type: application/json" -X POST http://localhost:8080/orderItems/66c11e3e-c211-4cee-9a07-848b5e861bc5/Verify_order/62f1c985-d31c-4ead-9906-2fe8d05937f0?user=john
|
||||
curl -d '{"transitionId": "complete"}' -H "Content-Type: application/json" -X POST http://localhost:8080/usertasks/instance/1dd3123a-aa2c-4b68-93c3-fd0c2abe76c8/transition?user=john
|
||||
```
|
||||
|
||||
|
||||
As response the updated order is returned.
|
||||
|
||||
Example response:
|
||||
|
||||
```json
|
||||
{
|
||||
"id":"66c11e3e-c211-4cee-9a07-848b5e861bc5",
|
||||
"order":
|
||||
{
|
||||
"orderNumber":"12345",
|
||||
"shipped":false,
|
||||
"total":0.537941914075738
|
||||
}
|
||||
}
|
||||
"id": "1dd3123a-aa2c-4b68-93c3-fd0c2abe76c8",
|
||||
"userTaskId": "UserTask_1",
|
||||
"status": {
|
||||
"terminate": "COMPLETED",
|
||||
"name": "Completed"
|
||||
},
|
||||
"taskName": "Verify order",
|
||||
...
|
||||
]
|
||||
```
|
||||
|
@ -138,38 +138,21 @@ this will then trigger the review user task that you can work.
|
||||
|
||||
### Get review task for given deal
|
||||
|
||||
First you can display all active reviews of deals
|
||||
You can display all active reviews of deals by running
|
||||
|
||||
```sh
|
||||
curl -H 'Content-Type:application/json' -H 'Accept:application/json' http://localhost:8080/dealreviews
|
||||
curl http://localhost:8080/usertasks/instance?user=john
|
||||
```
|
||||
|
||||
based on the response you can select one of the reviews to see more details
|
||||
|
||||
```sh
|
||||
curl -H 'Content-Type:application/json' -H 'Accept:application/json' http://localhost:8080/dealreviews/{uuid}/tasks?user=john
|
||||
```
|
||||
|
||||
where uuid is the id of the deal review you want to work with.
|
||||
|
||||
Next you can get the details assigned to review user task by
|
||||
|
||||
```sh
|
||||
curl -H 'Content-Type:application/json' -H 'Accept:application/json' http://localhost:8080/dealreviews/{uuid}/review/{tuuid}?user=john
|
||||
```
|
||||
|
||||
where uuid is the id of the deal review and tuuid is the id of the user task you want to get
|
||||
|
||||
|
||||
### Complete review task for given deal
|
||||
|
||||
Last but not least you can complete review user task by
|
||||
|
||||
```sh
|
||||
curl -X POST -H 'Content-Type:application/json' -H 'Accept:application/json' -d '{"review" : "very good work"}' http://localhost:8080/dealreviews/{uuid}/review/{tuuid}?user=john
|
||||
curl -X POST -H 'Content-Type:application/json' -H 'Accept:application/json' -d '{"transitionId":"complete","data":{"review" : "very good work"}}' http://localhost:8080/usertasks/instance/{tuuid}/transition?user=john
|
||||
```
|
||||
|
||||
where uuid is the id of the deal review and tuuid is the id of the user task you want to get
|
||||
where tuuid is the id of the user task you want to complete
|
||||
|
||||
* Review Log should look similar to
|
||||
|
||||
|
@ -119,18 +119,18 @@ In addition, various clients to interact with this service can be easily generat
|
||||
|
||||
To make use of this application it is as simple as putting a sending request to `http://localhost:8080/deals` with following content
|
||||
|
||||
```
|
||||
```json
|
||||
{
|
||||
"name" : "my fancy deal",
|
||||
"traveller" : {
|
||||
"firstName" : "John",
|
||||
"lastName" : "Doe",
|
||||
"email" : "jon.doe@example.com",
|
||||
"traveller" : {
|
||||
"firstName" : "John",
|
||||
"lastName" : "Doe",
|
||||
"email" : "jon.doe@example.com",
|
||||
"nationality" : "American",
|
||||
"address" : {
|
||||
"street" : "main street",
|
||||
"city" : "Boston",
|
||||
"zipCode" : "10005",
|
||||
"address" : {
|
||||
"street" : "main street",
|
||||
"city" : "Boston",
|
||||
"zipCode" : "10005",
|
||||
"country" : "US" }
|
||||
}
|
||||
}
|
||||
@ -147,43 +147,27 @@ this will then trigger the review user task that you can work with.
|
||||
|
||||
### Get review task for given deal
|
||||
|
||||
First you can display all active reviews of deals
|
||||
You can display all active reviews of deals by running
|
||||
|
||||
```sh
|
||||
curl http://localhost:8080/usertasks/instance?user=john
|
||||
```
|
||||
curl -H 'Content-Type:application/json' -H 'Accept:application/json' http://localhost:8080/dealreviews
|
||||
```
|
||||
|
||||
based on the response you can select one of the reviews to see more details
|
||||
|
||||
```
|
||||
curl -H 'Content-Type:application/json' -H 'Accept:application/json' http://localhost:8080/dealreviews/{uuid}/tasks?user=john
|
||||
```
|
||||
|
||||
where uuid is the id of the deal review you want to work with.
|
||||
|
||||
Next you can get the details assigned to review user task by
|
||||
|
||||
```
|
||||
curl -H 'Content-Type:application/json' -H 'Accept:application/json' http://localhost:8080/dealreviews/{uuid}/review/{tuuid}?user=john
|
||||
```
|
||||
|
||||
where uuid is the id of the deal review and tuuid is the id of the user task you want to get
|
||||
|
||||
|
||||
### Complete review task for given deal
|
||||
|
||||
Last but not least you can complete review user task by
|
||||
|
||||
```
|
||||
curl -X POST -H 'Content-Type:application/json' -H 'Accept:application/json' -d '{"review" : "very good work"}' http://localhost:8080/dealreviews/{uuid}/review/{tuuid}?user=john
|
||||
```sh
|
||||
curl -X POST -H 'Content-Type:application/json' -H 'Accept:application/json' -d '{"transitionId":"complete","data":{"review" : "very good work"}}' http://localhost:8080/usertasks/instance/{tuuid}/transition?user=john
|
||||
```
|
||||
|
||||
where uuid is the id of the deal review and tuuid is the id of the user task you want to get
|
||||
where tuuid is the id of the user task you want to complete
|
||||
|
||||
* Review Log should look similar to
|
||||
* Review Log should look similar to
|
||||
|
||||
```
|
||||
Review of the deal very good work for traveller Doe
|
||||
```
|
||||
|
||||
You can also query the process instance information and model variables from the database and review the same using tools like MongoDB Compass, download community version from below link
|
||||
https://www.mongodb.com/try/download/compass
|
||||
|
@ -145,61 +145,50 @@ Example response:
|
||||
]
|
||||
```
|
||||
|
||||
### GET /orderItems/{id}/tasks
|
||||
### GET /usertasks/instance?user={user}
|
||||
|
||||
Getting user tasks awaiting user action
|
||||
|
||||
```sh
|
||||
curl -X GET http://localhost:8080/orderItems/66c11e3e-c211-4cee-9a07-848b5e861bc5/tasks?user=john
|
||||
curl -X GET http://localhost:8080/usertasks/instance?user=john
|
||||
```
|
||||
Example response:
|
||||
|
||||
```json
|
||||
[
|
||||
{"id":"62f1c985-d31c-4ead-9906-2fe8d05937f0","name":"Verify order"}
|
||||
{
|
||||
"id": "1dd3123a-aa2c-4b68-93c3-fd0c2abe76c8",
|
||||
"userTaskId": "UserTask_1",
|
||||
"status": {
|
||||
"terminate": null,
|
||||
"name": "Reserved"
|
||||
},
|
||||
"taskName": "Verify order",
|
||||
...
|
||||
]
|
||||
```
|
||||
|
||||
### GET /orderItems/{id}/Verify_order/{tid}
|
||||
|
||||
Getting user task details
|
||||
|
||||
```sh
|
||||
curl -X GET http://localhost:8080/orderItems/66c11e3e-c211-4cee-9a07-848b5e861bc5/Verify_order/62f1c985-d31c-4ead-9906-2fe8d05937f0?user=john
|
||||
```
|
||||
Example response:
|
||||
```json
|
||||
{
|
||||
"id":"62f1c985-d31c-4ead-9906-2fe8d05937f0",
|
||||
"input1":
|
||||
{
|
||||
"orderNumber":"12345",
|
||||
"shipped":false,
|
||||
"total":0.537941914075738
|
||||
},
|
||||
"name":"Verify order"
|
||||
}
|
||||
```
|
||||
|
||||
### POST /orderItems/{id}/Verify_order/{tid}
|
||||
### POST /usertasks/instance/{taskId}/transition?user={user}
|
||||
|
||||
Complete user task
|
||||
|
||||
```sh
|
||||
curl -d '{}' -H "Content-Type: application/json" -X POST http://localhost:8080/orderItems/66c11e3e-c211-4cee-9a07-848b5e861bc5/Verify_order/62f1c985-d31c-4ead-9906-2fe8d05937f0?user=john
|
||||
curl -d '{"transitionId": "complete"}' -H "Content-Type: application/json" -X POST http://localhost:8080/usertasks/instance/1dd3123a-aa2c-4b68-93c3-fd0c2abe76c8/transition?user=john
|
||||
```
|
||||
|
||||
|
||||
As response the updated order is returned.
|
||||
|
||||
Example response:
|
||||
|
||||
```json
|
||||
{
|
||||
"id":"66c11e3e-c211-4cee-9a07-848b5e861bc5",
|
||||
"order":
|
||||
{
|
||||
"orderNumber":"12345",
|
||||
"shipped":false,
|
||||
"total":0.537941914075738
|
||||
}
|
||||
}
|
||||
"id": "1dd3123a-aa2c-4b68-93c3-fd0c2abe76c8",
|
||||
"userTaskId": "UserTask_1",
|
||||
"status": {
|
||||
"terminate": "COMPLETED",
|
||||
"name": "Completed"
|
||||
},
|
||||
"taskName": "Verify order",
|
||||
...
|
||||
]
|
||||
```
|
||||
|
Reference in New Issue
Block a user