The Camunda REST API cannot be accessed

After downloading the demo of start.camunda.com, I cannot access the Camunda REST API documentation. The version is 7.17.0. The configuration is as follows:


Who can tell me what the path to the Camunda REST API is. I tried http://localhost:8080/engine-rest/, and http://localhost:8080/swaggerui/ didn’t work

Hi @DeepDreamerLSC

Do you see anything at http://localhost:8080/ ?

Josh

Hello @jwulf
I can see the Camunda BPM platform at http://localhost:8080/,I think it’s normal.
Lin

Hi @DeepDreamerLSC

What exact URL did you try? What was the exception?

If I call http://localhost:8080/engine-rest I get a 404.

With for example http://localhost:8080/engine-rest/deployment I get a result

Hi @pme123
If I call http://localhost:8080/engine-rest,I get a 404 too,
but call http://localhost:8080/engine-rest/deployment,I get this exception.
image
I basically throw this exception when I call other url.
But I also introduced the REST API dependency.

Lin

Hi @DeepDreamerLSC

Ok I downloaded the starter and tested it - works as expected (I am on a Mac).

This is the curl Call I used:

curl --location --request GET 'http://localhost:8080/engine-rest/deployment'

Which returns
[{"links":[],"id":"7f14c496-1fe6-11ed-b424-8e5db46a7499","name":"SpringAutoDeployment","source":null,"deploymentTime":"2022-08-19T19:43:55.326+0200","tenantId":null}]

Hi @pme123
I’m glad to see that I got the same result, which seems to mean I can call the REST API’s interface normally, so why not access the API documentation?
LIN

@DeepDreamerLSC @pme123
I guess you are trying to see swagger docs/ open api specification.
That is not enabled by default in spring boot projects. You have to make following changes and then it will work.

  1. Add following dependencies in your pom.xml
<dependency>
  <groupId>org.camunda.bpm</groupId>
  <artifactId>camunda-engine-rest-openapi</artifactId>
  <version>7.17.0</version>
</dependency>
<dependency>
  <groupId>org.camunda.bpm.run</groupId>
  <artifactId>camunda-bpm-run-modules-swaggerui</artifactId>
  <version>7.17.0</version>
</dependency>
  1. Add following repository to your pom.xml because by default these dependencies are not available on maven central.
<repositories>
  <repository>
    <id>camunda-bpm-nexus</id>
    <name>Camunda Platform Maven Repository</name>
    <url>https://artifacts.camunda.com/artifactory/public/</url>
  </repository>
</repositories>

Make sure you rebuild the project so that dependencies are downloaded.
The URL for swaggerui is as below .

http://localhost:8080/swaggerui/

4 Likes

Hi @ad_sahota
Thank you very much, it’s a usable way and it’s really the result I wanted
Lin

Here is an update for Camunda 7.20 and Springboot 3.x.x . The same is achievable by using springdoc library as well. Here are the steps I did

  1. Download the camunda-engine-rest-openapi-7.XX.X.jar from JFrog (camunda.com) Download the Jar version same as Caunda version you plan to use.
  2. Unzip this Jar using 7zip or any other tool. You will find a file openapi.json inside it. This contains the OPENAPI specs for Camunda.
  3. Paste openapi.json inside src\main\resources\static folder of your project.
  4. Add following dependency in your pom.xml
    Check the latest version of library whenever you are reading this.
    <dependency>
      <groupId>org.springdoc</groupId>
      <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
      <version>2.3.0</version>
    </dependency>
  1. Add following configuration in your application.yml
springdoc:
  api-docs:
    enabled: true
  swagger-ui:
    url: /openapi.json
    path: /swaggerui

That’s it. Now swagger ui is accessible at http://localhost:8080/swaggerui

Advantage:

  1. You don’t need to add Camunda Maven repo
  2. You can selectively enable/disable it

Reference repo : amardeep2006/camunda-springboot-swaggerui-added: Sample project showcase on how to add swaggerui in Camunda (github.com)

Reference for springdoc :
OpenAPI 3 Library for spring-boot (springdoc.org)