Camunda custom rest payload


#1

Hi Everyone.

I was using a camunda process application and I was starting the processes by using the rest api.
ex: http://localhost:8080/engine-rest/engine/process-definition/key//start

Now the problem is that I need to pass a payload that is not formed in camunda way, it has no variables and even though I tried to follow this guide
https://docs.camunda.org/manual/7.10/reference/rest/overview/embeddability/
I can not get it to work.

Does anyone have any good guide for a simple quickstart?
Thank you very much for the support.


#2

Salvatore,

You have several options for interacting with Camunda via REST. One of them is obviously via the provided REST API, which is made available via the “engine-rest” WAR file in the default distribution. You have two other options:

  1. As you’ve pointed out via the link included above, you can build your own REST API that interacts with Camunda via its Java API. This obviously requires Java. Note that you don’t have to use the tools cited in the documentation that you linked; there are many tools out there in the Java ecosystem that will allow you to build REST API endpoints. It’s also worth noting that you don’t even have to run that REST API host on the same host as your regular Camunda instance; as long as the REST API has access to the Java libraries and can connect to the same back-end database, it will work.

  2. Importantly, you can also interact with the REST API through a proxy, e.g. something like NodeJS. In other words, you could have a Node application “wrap” the REST API calls to Camunda, and you can then accept any format of data that you’d like, transforming that into the JSON (JavaScript Object) based representation that Camunda requires. If you’re more familiar with another language and don’t mind the (slight) performance hit associated with wrapping a REST API call, this may be the right option for you.

I hope this helps!

-Ryan


#3

Hi Ryan!
Thank you for the answer!
One of the options that I tried (this time successfully) was by using the restcontroller of spring, from the method I execute with variable in return. Am I using some bad practice or this solution is ok? Thank you for the support again, appreciated


#4

Happy to be able to assist. :slight_smile:

That approach sounds good! Camunda is an open platform, and the philosophy - generally - is that you can use any component in the Java universe to build your solutions. If Spring @RestController annotated items work for you, then you should use them.

Continued good luck to you in your endeavors with Camunda.

-Ryan