LoginSignup
3
2

More than 5 years have passed since last update.

Camunda の REST API を試してみる

Last updated at Posted at 2016-02-08

CamundaはディベロッパーフレンドリーなBPMプラットフォームです。幾つかのrest APIを試してみた時に実行したcURLコマンドをメモしておきます。

環境
  • camunda BPM platform version: 7.4.0 (1 ~ 3) / 7.5.0 (4)
  • Apache Tomcat Server version: 8.0.24

1. タスク操作系API

1.1. タスクの一覧を取得する。

メソッド

GET /task

サンプルcURLコマンド

curl http://localhost:8080/engine-rest/task --verbose

詳細解説

https://docs.camunda.org/manual/7.3/api-references/rest/#task-get-tasks

1.2. IDを指定してタスクを取得する。

メソッド

GET /task/{id}

サンプルcURLコマンド

curl http://localhost:8080/engine-rest/task/8679ba26-869d-11e5-94ab-b2d959134290 --verbose

詳細解説

https://docs.camunda.org/manual/7.3/api-references/rest/#task-get-single-task

1.3. タスクの件数を取得する。

メソッド

GET /task/count

サンプルcURLコマンド

curl http://localhost:8080/engine-rest/task/count --verbose

詳細解説

https://docs.camunda.org/manual/7.3/api-references/rest/#task-get-tasks-count

1.4. タスクを生成する

メソッド

POST /task/create

サンプルcURLコマンド

curl 'http://localhost:8080/engine-rest/task/create' \
--request POST \
--header "Content-Type: application/json" \
--data-binary '{"name":"screening","assignee":"demo","description":"hoge hoge fuga fuga"}' \
--verbose

詳細解説

https://docs.camunda.org/manual/7.3/api-references/rest/#task-create-task

2. 履歴操作系API

2.1. タスクの履歴件数を取得する

メソッド

GET /history/task/count

サンプルcURLコマンド

curl http://localhost:8080/engine-rest/history/task/count --verbose

詳細解説

https://docs.camunda.org/manual/7.3/api-references/rest/#history-get-task-count

3. ユーザー操作系API

3.1. ユーザー情報を取得する

メソッド

GET /user

サンプルcURLコマンド

curl 'http://localhost:8080/engine-rest/user?id=178' --verbose

詳細解説

https://docs.camunda.org/manual/7.3/api-references/rest/#user-get-users

3.2. ユーザーを作成する

メソッド

POST /user/create

サンプルcURLコマンド

curl 'http://localhost:8080/engine-rest/user/create' \
--request POST \
--header "Content-Type: application/json" \
--data-binary '{"profile": {"id": "178", "firstName":"Hoge", "lastName":"Fuga", "email":"hoge@fuga.io"}, "credentials": {"password":"12345678"}}' \
--verbose

詳細解説

https://docs.camunda.org/manual/7.3/api-references/rest/#user-create-user

3.3. ユーザーを削除する

メソッド

DELETE /user/{id}

サンプルcURLコマンド

curl 'http://localhost:8080/engine-rest/user/178' --request DELETE --verbose

詳細解説

4. リソース操作系API

4.1. リソースを参照する。

メソッド

GET /deployment/{id}/resources

サンプルcURLコマンド

curl 'http://192.168.43.178:8080/camunda/api/engine/engine/default/deployment/b6f32ca3-2dfb-11e6-98d5-08002703433f/resources' \
-H 'Cookie: JSESSIONID={適当に取得して下さい}' \
-H 'Connection: keep-alive'

詳細解説

4.2. リソースを再デプロイする。

メソッド

POST /deployment/{id}/redeploy

サンプルcURLコマンド

curl 'http://192.168.43.178:8080/camunda/api/engine/engine/default/deployment/b6f32ca3-2dfb-11e6-98d5-08002703433f/redeploy' \
-H 'Content-Type: application/json' \
-H 'Cookie: JSESSIONID=kjcddrwwo1zo1ejsx4bbmek0u' \
-H 'Connection: keep-alive' \
--data-binary '{"resourceIds":["b6f32ca5-2dfb-11e6-98d5-08002703433f"],"resourceNames":["pa2/sorting-process.bpmn"],"source":"process application"}'

詳細解説

4.3. リソースをデプロイする。

メソッド

POST /deployment/create

サンプルcURLコマンド

curl -i -X POST \
-H 'Cookie: JSESSIONID=kjcddrwwo1zo1ejsx4bbmek0u' \
-H 'Connection: keep-alive' \
-F "data=@myprocessfilelocally;tenant-id=1;deployment-source=process-application;deployment-name=sample1" \
http://192.168.43.178:8080/camunda/api/engine/engine/default/deployment/create

詳細解説

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2