An open API service indexing awesome lists of open source software.

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

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'
```