https://github.com/dmarrazzo/process-rest
Example of how to use REST work item handler calling PET store
https://github.com/dmarrazzo/process-rest
Last synced: 3 months ago
JSON representation
Example of how to use REST work item handler calling PET store
- Host: GitHub
- URL: https://github.com/dmarrazzo/process-rest
- Owner: dmarrazzo
- Created: 2021-11-05T11:18:51.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-11-05T11:41:04.000Z (over 3 years ago)
- Last Synced: 2025-01-22T20:51:19.225Z (5 months ago)
- Language: VBA
- Size: 88.9 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
RHPAM Rest call example (jBPM)
=====================================This example leverages the PET Store public REST API:
https://petstore.swagger.io/
Highlights
-------------------------------------- REST Workitem handler configuration
- Deployment Descriptor `src/main/resources/META-INF/kie-deployment-descriptor.xml`
- Configuration in the assignment panel:
- Multiple environment handling via system property: `#{System.getProperty("service.pet.url","https://petstore.swagger.io/v2/pet/")+pet.id}`
- Raising exception `HandleResponseErrors`
- Defining the `ResultClass`- Local Exception Handling
- Complex script logic delegated to Java class methods, see: `src/main/java/com/examples/script/PetProcess.java`
Pet REST Service
-------------------------------------In case the pet is not there you can add it through this command:
Add a pet:
```sh
curl -X 'POST' 'https://petstore.swagger.io/v2/pet' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{ "id":123,
"name": "fuffy",
"status": "available",
"category": {
"name": "fish"
},
"photoUrls": [
"url"
],
"tags": [
{
"name": "red"
}
]
}'
```Get Pet:
```sh
curl -i -X 'GET' \
'https://petstore.swagger.io/v2/pet/123' \
-H 'accept: application/json'
```