Camunda Standalone REST API


#1

Hello! Regarding to the DOCs is written that for the systems in production is recommended to use Standalone application war (camunda-webapp-tomcat-standalone-7.10.0). Currently trying to access rest-engine in order to deploy a process using Postman calling http://localhost:8080/camunda/api/engine/engine/default/deployment/create.
Obviously, the path from the tutorials /rest-engine/… is not accessible (404 - not found)

All the time getting:

Message Cannot create a session after the response has been committed

java.lang.IllegalStateException: Cannot create a session after the response has been committed
org.apache.catalina.connector.Request.doGetSession(Request.java:2974) org.apache.catalina.connector.Request.getSession(Request.java:2416) org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:908) org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:920) org.camunda.bpm.webapp.impl.security.auth.AuthenticationFilter.doFilter(AuthenticationFilter.java:67)


#2

Why exactly are you using

instead of:

localhost:8080/engine-rest/deployment/create

#3

Because, as I mentioned in the main question, the path localhost:8080/engine-rest/deployment/create does not exist, I’m getting 404. Indeed, because I’m not deploying the engine manually, but use your package from here:
https://docs.camunda.org/manual/7.10/installation/standalone-webapplication/

and there is written, that the engine is embedded. Did the misunderstanding happen and in order I’m able to use engine-rest I must deploy the engine also separately?

Or what would be in general the best solution for using your product? We wouldn’t want to embeed your engine manually in a new project and develop and support it. Instead, we want to use your engine with some basic front-end apps and using the REST Api of it in order to communicate with our services (web services, not people)


#4

The REST API you’re trying to use is reserved for the webapps, so you won’t be able to use it. If you want to use the REST API you need to deploy it to the application server that you’re using.

The engine itself does not have the REST API with it, so if you embed the engine you need to independently expose the REST API. so the reason you’re getting the 404 is because you haven’t properly deployed the REST API.


#5

Where can I find a war package with engine-rest? I can see it already deployed in a package camunda-bpm-tomcat-7.10.0 but can’t find ot separately zipped in war.


#6

From the Maven nexus server


#7

Hi, Yana! I’ve downloaded 7.10.0 version from here https://app.camunda.com/nexus/content/groups/public/org/camunda/bpm/camunda-engine-rest/7.10.0/camunda-engine-rest-7.10.0.war
Deploying it to the Tomcat container. When calling http://localhost:8080/camunda-engine-rest-7.10.0/deployment/create - getting “HTTP Status 404 – Not Found”. In a Tomcat admin panel I see the deployment and that it’s active.


#8

check if the path is correct and the engine is started


#9

Yes, as I said above. Firstly I checked if everything is up.

I’ve almost given up with using your war and now trying to build an app with your dependencies of camunda. Also doesnt work. Probably I should also open a question with this issue…

Camunda documentation looked so easy, good written and full until I started trying to develope smth that could be used for production…


#10

I use SpringBoot with Camunda and the path would be localhost:8080/rest/engine/default/deploy/create and I think you can use “localhost:8080//engine-rest/default/deploy/create” or try “localhost:8080/engine-rest/engine/” to see if it is up for a tomcat install… just a guess, but give it a try.


#11

Hi! After several days I’m back again. I’ve given up with the idea of deploying rest-engine from the Maven nexus server.

I’ve figured out how to embed the engine in the spring boot application. Unfortunately here I’m also experiencing problems. Don’t know if I should move my question. I’ll ask here, but if needed I’ll move it to another topic.

Currently when I’m calling
curl -X GET
http://localhost:8080/rest/engine/default/
-H ‘Postman-Token: e4220932-e26d-4a98-9399-6d3ac054f2f5’
-H ‘cache-control: no-cache’ ,
I’m getting:

{
“timestamp”: “2019-02-12 04:46:10”,
“status”: 401,
“error”: “Unauthorized”,
“message”: “Full authentication is required to access this resource”,
“path”: “/rest/engine/default/”
}

Why?


#12

After several attempts thanks to your reply I’ve also started using SpringBoot. The path you’ve mentioned is accessible for me now. But it’s asking for authorization (my comment below). How did you figured out with that issue?

And another question which I’m facing up is how to use then all those camunda apps such Cockpit, Admin etc? How did you connect all of them with your SpringBoot app?


#13

Solved. The issue was at the main spring dependencies.

Since I haven’t got the solution to my very first question, I’m posting here my build.gradle configs in order to help smb like me. Don’t know yet if it works as needed but so far I can run it and get info about engine and etc.

apply plugin: “java”
apply plugin: “eclipse”
apply plugin: “idea”
apply plugin: “org.springframework.boot”
apply plugin: “io.spring.dependency-management”

buildscript {
repositories {
mavenCentral()
maven {
url “https://plugins.gradle.org/m2/
}
}
dependencies {
classpath “org.springframework.boot:spring-boot-gradle-plugin:1.5.14.RELEASE”
}
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

jar {
baseName = “camunda”
version = “0.1.0”
}

repositories {
mavenCentral()
maven {
url “https://plugins.gradle.org/m2/
}
}

dependencies {

// JPA Data (We are going to use Repositories, Entities, Hibernate, etc...)
compile "org.springframework.boot:spring-boot-starter-data-jpa"

// Use MySQL Connector-J
compile "mysql:mysql-connector-java"

runtime "org.springframework.boot:spring-boot-devtools"

compile "org.springframework.boot:spring-boot-starter"
compile "org.springframework.boot:spring-boot-starter-web"
compile "org.springframework.boot:spring-boot-starter-actuator"

// logback
compile "ch.qos.logback:logback-core"
compile "net.logstash.logback:logstash-logback-encoder:4.6"
compile "org.codehaus.janino:janino:3.0.8"


compile group: "org.camunda.bpm", name: "camunda-engine", version: "7.6.0"
compile group: "org.camunda.bpm", name: "camunda-engine-spring", version: "7.6.0"
compile group: "org.camunda.bpm", name: "camunda-engine-rest", version: "7.6.0"
compile group: "org.jboss.resteasy", name: "resteasy-jaxrs", version: "3.1.2.Final"
compile group: "org.camunda.bpm.extension.springboot", name: "camunda-bpm-spring-boot-starter-rest", version: "2.0.0" 

}

this question can be closed. However, I’ll open another one with the question, how I can connect it now to the Webapps of camunda


#14

Good to see you got it working. Assume you found the documentation, but here it is just in case. https://docs.camunda.org/get-started/spring-boot/

Good luck!