# How to use rest api in docker

**URL:** <https://forum.flowable.org/t/how-to-use-rest-api-in-docker/2977>\
**Category:** Flowable Engine\
**Created:** [December 2, 2018, 2:09pm UTC](https://forum.flowable.org/t/how-to-use-rest-api-in-docker/2977 "2018-12-02T14:09:37Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![xcaptain](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/xcaptain/32/1286_2.png) [@xcaptain](https://forum.flowable.org/u/xcaptain)\
**Post date:** [December 2, 2018, 2:09pm UTC](https://forum.flowable.org/t/how-to-use-rest-api-in-docker/2977/1 "2018-12-02T14:09:38Z")

</div>

I tried flowable using the all-in-one docker image, it works well ,now I want to setup rest api to see how I can interact with flowable engine, but I found the rest module is not included in all-in-one image.

My setup is as below:

1. `docker run --rm -p 8080:8080 flowable/all-in-one`
2. `docker run -p 8080:8080 flowable/flowable-rest`

But 8080 is already in use, how can I integrate rest api with the flowable UI, Thanks!

---

<div class="post-metadata">

**Author:** ![filiphr](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/filiphr/32/315_2.png) [@filiphr](https://forum.flowable.org/u/filiphr)\
**Post date:** [December 2, 2018, 4:02pm UTC](https://forum.flowable.org/t/how-to-use-rest-api-in-docker/2977/2 "2018-12-02T16:02:21Z")

</div>

The `flowable-task` application has the REST API exposed in the same way as the `flowable-rest`. Which means that you can invoke the REST API via the `flowable-task`.

In case you want to run `flowable-task` and `flowable-rest` then you would need to run the `flowable-rest` on another port. For example with `docker run -p 8081:8080 flowable/flowable-rest` the flowable-rest application will run on port 8081

---

<div class="post-metadata">

**Author:** ![xcaptain](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/xcaptain/32/1286_2.png) [@xcaptain](https://forum.flowable.org/u/xcaptain)\
**Post date:** [December 3, 2018, 2:55am UTC](https://forum.flowable.org/t/how-to-use-rest-api-in-docker/2977/3 "2018-12-03T02:55:57Z")

</div>

Thanks, but `docker run -p 8081:8080 flowable/flowable-rest` cannot connect to existing all-in-one docker container. I run `curl 'http://rest-admin:test@localhost:8081/flowable-rest/service/repository/deployments'` only returned the default demo app.

Are there any better ways to combine the `all-in-one` docker image with `flowable-rest` image? I’ll try `flowable-task` rest api to see if it works.

---

<div class="post-metadata">

**Author:** ![xcaptain](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/xcaptain/32/1286_2.png) [@xcaptain](https://forum.flowable.org/u/xcaptain)\
**Post date:** [December 3, 2018, 3:19am UTC](https://forum.flowable.org/t/how-to-use-rest-api-in-docker/2977/4 "2018-12-03T03:19:01Z")

</div>

I tried `flowable-task` rest api, but it doesn’t support http basic authenticate, so the problems I’m facing are:

1. `flowable-rest` docker cannot directly connect to `flowable-task`
2. `flowable-task` api doesn’t support http basic authenticate so cannot integrate into my app

I think the possible solutions are:

1. manually write docker file to combine the 2 images.
2. manually deploy these services to tomcat

But these 2 solutions are too tedious, hope to see a simpler way.

---

<div class="post-metadata">

**Author:** ![filiphr](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/filiphr/32/315_2.png) [@filiphr](https://forum.flowable.org/u/filiphr)\
**Post date:** [December 3, 2018, 6:55am UTC](https://forum.flowable.org/t/how-to-use-rest-api-in-docker/2977/5 "2018-12-03T06:55:35Z")

</div>

> [@xcaptain](#):
>
> Thanks, but `docker run -p 8081:8080 flowable/flowable-rest` cannot connect to existing all-in-one docker container. I run `curl 'http://rest-admin:test@localhost:8081/flowable-rest/service/repository/deployments'` only returned the default demo app.

Yes you need to configure the database properties for it to access the same database as the `all-in-one` docker.

> [@xcaptain](#):
>
> I tried `flowable-task` rest api, but it doesn’t support http basic authenticate

It does support basic authentication. Have a look at the [`ApiWebSecurityConfigurationAdapter `](https://github.com/flowable/flowable-engine/blob/70b0101c49be04ef78bff9a9f8d5d031a8e36256/modules/flowable-ui-task/flowable-ui-task-conf/src/main/java/org/flowable/ui/task/conf/SecurityConfiguration.java#L125) for the task app. You can access the process api under `/flowable-task/process-api`. Why do you have the impression that it doesn’t work?

The `flowable-admin` application actually uses the REST API to display its data.

Cheers,  
Filip

---

<div class="post-metadata">

**Author:** ![xcaptain](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/xcaptain/32/1286_2.png) [@xcaptain](https://forum.flowable.org/u/xcaptain)\
**Post date:** [December 3, 2018, 7:04am UTC](https://forum.flowable.org/t/how-to-use-rest-api-in-docker/2977/6 "2018-12-03T07:04:37Z")

</div>

Thanks for the explainations, I don’t write java so I didn’t read the source code carefully. I don’t want to use `flowable-task` api, I’m working on my own docker compose file to combine `all-in-one` and `flowable-rest`

---

<div class="post-metadata">

**Author:** ![filiphr](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/filiphr/32/315_2.png) [@filiphr](https://forum.flowable.org/u/filiphr)\
**Post date:** [December 3, 2018, 7:17am UTC](https://forum.flowable.org/t/how-to-use-rest-api-in-docker/2977/7 "2018-12-03T07:17:20Z")

</div>

The public REST API in `flowable-task` and `flowable-rest` is identical. Why don’t you want to use that one?

---

<div class="post-metadata">

**Author:** ![xcaptain](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/xcaptain/32/1286_2.png) [@xcaptain](https://forum.flowable.org/u/xcaptain)\
**Post date:** [December 3, 2018, 7:19am UTC](https://forum.flowable.org/t/how-to-use-rest-api-in-docker/2977/8 "2018-12-03T07:19:19Z")

</div>

I don’t know how to do http authentication in `flowable-task` and its usage is not listed in the [doc](https://www.flowable.org/docs/userguide/index.html#restApiChapter)

---

<div class="post-metadata">

**Author:** ![xcaptain](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/xcaptain/32/1286_2.png) [@xcaptain](https://forum.flowable.org/u/xcaptain)\
**Post date:** [December 3, 2018, 7:25am UTC](https://forum.flowable.org/t/how-to-use-rest-api-in-docker/2977/9 "2018-12-03T07:25:07Z")

</div>

I got a 302 redirect when using `flowable-task`

![image](https://cdck-file-uploads-canada1.s3.dualstack.ca-central-1.amazonaws.com/flex035/uploads/flowable/original/1X/1ad666af6e88d7207116e9111f455db22fdc5d6b.png)

![image](https://cdck-file-uploads-canada1.s3.dualstack.ca-central-1.amazonaws.com/flex035/uploads/flowable/original/1X/3d02388433e5ed8c3302c7793f4172961aee315c.png)

---

<div class="post-metadata">

**Author:** ![filiphr](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/filiphr/32/315_2.png) [@filiphr](https://forum.flowable.org/u/filiphr)\
**Post date:** [December 3, 2018, 7:31am UTC](https://forum.flowable.org/t/how-to-use-rest-api-in-docker/2977/10 "2018-12-03T07:31:46Z")

</div>

> [@filiphr](#):
>
> You can access the process api under `/flowable-task/process-api` . Why do you have the impression that it doesn’t work?

Instead of doing `flowable-task/service` do `flowable-task/process-api`. And you should not be accessing the API that is under `flowable-task/app`. That API is for the UI app.

The things which are explained in the documentation are valid for the `flowable-task` as well. With the following differences:

- The installation is different (already part of the `flowable-task` UI application
- Replace all `flowable-rest/service` with `flowable-task/process-api`

Cheers,  
Filip

---

<div class="post-metadata">

**Author:** ![xcaptain](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.flowable.org/xcaptain/32/1286_2.png) [@xcaptain](https://forum.flowable.org/u/xcaptain)\
**Post date:** [December 3, 2018, 7:38am UTC](https://forum.flowable.org/t/how-to-use-rest-api-in-docker/2977/11 "2018-12-03T07:38:41Z")

</div>

Thanks, you are awesome, you saved me a lot of time, now I can interact with `flowable-task` rest api

`curl -i 'http://admin:test@localhost:8080/flowable-task/process-api/repository/deployments'`

![image](https://cdck-file-uploads-canada1.s3.dualstack.ca-central-1.amazonaws.com/flex035/uploads/flowable/original/1X/411625aafbd4be30e95d4ee9c7111936b2c0fde1.png)
