How to connect to REST API


#1

Hello,
I am trying to connect from my javascript front to the REST API of my camunda orchestration which is deployed as part of a spring boot application.

the called url is :
GET http://localhost:8081/orchestrator/api/engine/engine/default/history/process-instance.
i get an 401 error for non authenticated queries which is normal

First question : is it the right way to query the Engine Rest API for process definition/ instances and history?

In order to make it work , i add the JSESSIONID cookie as header to my requests,
how can i use the basic auth to query the orchestrator api instead of using the cookie?

I think same question in this stackoverflow :

when calling the rest-engine i get 404
http://localhost:8081/orchestrator/engine-rest/process-definition/finance-process:1:73c2ea9d-15f7-11e9-9484-00155d076c61/statistics

i have the spring-boot-starter-rest dependency in my pom

<dependency>
    <groupId>org.camunda.bpm.springboot</groupId>
    <artifactId>camunda-bpm-spring-boot-starter-rest</artifactId>
</dependency>

Thanks for your Help


#2

If you are using Spring Boot Starter Rest the default rest endpoint would be
localhost:8080/rest/

Per default for this endpoint you do not need any authentication.
https://docs.camunda.org/manual/7.10/user-guide/spring-boot-integration/rest-api/
Does that help you?


#3

Yes Thanks, i figured it out, i was using the cockpit api. instead of engine rest api
i tried to delete the thread …


#4

Hi @lhou
thanks for the feedback and happy that you solved the issue.
There is no need to delete the thread as others might find it useful in the future.

Best
Felix