API Gateway integration

I have a simple orchestration tool that calls 3 API’s sequentially using http-connectors in service tasks. I can start the process using the camunda rest API, and am now trying to integrate this tool with an API gateway.

That is, I need to pass the header information contained in the POST request to start the process instance to all the service tasks that call the API’s. The POST request will have an access token as one of the key-value pairs of the header, and this access token has to be passed to the header information of the http-connector of each of the API’s.

Is there any way of doing this, because I haven’t found anything similar online?

Hi @A.Gupta,

You could write a custom REST API endpoint that extracts the header and then calls the Camunda Java API providing the header value as a process variable.

Another idea could be a servlet filter that sets the header value as a thread-local and that you access and store immediately as process variable when the process is started (e.g. in an execution listener). That could save the effort of rolling a custom REST API.

Cheers,
Thorben

Thank you for your response. I think the servlet filter might be easiest to implement.

My workflow engine right now is classless though, and I have implemented all my API calls through Javascript currently.

Do you have any advice as to where to implement the servlet filter? And whether it is possible to still do it classlessly?

Hi @A.Gupta,

I think you won’t get around Java for implementing the servlet filter. There are plenty of tutorials on the web for how to implement servlet filters, e.g. http://tutorials.jenkov.com/java-servlets/servlet-filters.html. You would then extend the REST API artifact by extending its web.xml descriptor. You can for example automate that process by building a Maven WAR overlay, see e.g. https://dzone.com/articles/mavens-war-overlay-what-are.

Cheers,
Thorben