Skip to content

Instantly share code, notes, and snippets.

@katoy
Last active August 29, 2015 14:18
Show Gist options
  • Save katoy/4b1578c17fb75803f7ed to your computer and use it in GitHub Desktop.
Save katoy/4b1578c17fb75803f7ed to your computer and use it in GitHub Desktop.
camunda の rest api を呼び出してみる
# ------ 実行例
$ ruby rest.rb
id:064c0150-db48-11e4-835e-12f5ba1407e2, name:"ローン申請の 審査"
id:073f66b2-db36-11e4-bc81-12f5ba1407e2, name:"Assign Approver"
id:077a4cf8-db36-11e4-bc81-12f5ba1407e2, name:"Review Invoice"
id:0bd16b17-db39-11e4-b167-12f5ba1407e2, name:"Assign Approver"
id:0bf6a67d-db39-11e4-b167-12f5ba1407e2, name:"Review Invoice"
id:247d07d5-db14-11e4-9656-12f5ba1407e2, name:"Prepare Bank Transfer"
id:304be6fb-db4e-11e4-b444-12f5ba1407e2, name:"Assign Approver"
id:3079fbeb-db4e-11e4-b444-12f5ba1407e2, name:"Approve Invoice"
id:308e6d61-db4e-11e4-b444-12f5ba1407e2, name:"Review Invoice"
id:410a1972-dfd0-11e4-81d8-06b6f8825ebc, name:"Assign Approver"
id:41705562-dfd0-11e4-81d8-06b6f8825ebc, name:"Approve Invoice"
id:417e3828-dfd0-11e4-81d8-06b6f8825ebc, name:"Review Invoice"
id:661aee65-db13-11e4-9656-12f5ba1407e2, name:"Approve Invoice"
id:6626602b-db13-11e4-9656-12f5ba1407e2, name:"Review Invoice"
id:80d5890d-db4d-11e4-835e-12f5ba1407e2, name:"ローン申請の 審査"
id:90db6f30-db3f-11e4-835e-12f5ba1407e2, name:"Assign Approver"
id:910b0ad6-db3f-11e4-835e-12f5ba1407e2, name:"Review Invoice"
id:ce38d4ba-da7f-11e4-a49f-12f5ba1407e2, name:"Approve Invoice"
id:ce441f70-da7f-11e4-a49f-12f5ba1407e2, name:"Review Invoice"
id:d19f0cc6-db47-11e4-835e-12f5ba1407e2, name:"Review Invoice"
id:d31272ee-db47-11e4-835e-12f5ba1407e2, name:"Review Invoice"
id:d4b26756-db47-11e4-835e-12f5ba1407e2, name:"Review Invoice"
id:d52b8c93-db13-11e4-9656-12f5ba1407e2, name:"Prepare Bank Transfer"
id:d9d2c22e-da7e-11e4-8582-12f5ba1407e2, name:"Assign Approver"
id:d9ee397e-da7e-11e4-8582-12f5ba1407e2, name:"Approve Invoice"
id:d9f90f04-da7e-11e4-8582-12f5ba1407e2, name:"Review Invoice"
id:e2107ece-dff9-11e4-9b84-febf8538e090, name:"Assign Approver"
id:e244390e-dff9-11e4-9b84-febf8538e090, name:"Approve Invoice"
id:e2517f94-dff9-11e4-9b84-febf8538e090, name:"Review Invoice"
id:e30da202-dfdf-11e4-923d-3e88ebd10335, name:"Assign Approver"
id:e33611a2-dfdf-11e4-923d-3e88ebd10335, name:"Approve Invoice"
id:e34294d8-dfdf-11e4-923d-3e88ebd10335, name:"Review Invoice"
id:f0436e94-db13-11e4-9656-12f5ba1407e2, name:"Prepare Bank Transfer"
id:fbe01b4c-da7e-11e4-a64f-12f5ba1407e2, name:"Approve Invoice"
id:fbec2852-da7e-11e4-a64f-12f5ba1407e2, name:"Review Invoice"
require 'rest_client'
BASE_URL = 'http://localhost.:8080/engine-rest/task'
# See
# http://docs.camunda.org/latest/api-references/rest/
#
# URL example:
# http://localhost.:8080/engine-rest/authorization
# http://localhost.:8080/engine-rest/deployment
# http://localhost.:8080/engine-rest/filter
# http://localhost.:8080/engine-rest/group
# http://localhost.:8080/engine-rest/task
# http://localhost.:8080/engine-rest/history/activity-instance
# http://localhost.:8080/engine-rest/history/task
# http://localhost.:8080/engine-rest/process-definition/nvoice:1:d9b4d9bb-da7e-11e4-8582-12f5ba1407e2/diagram
# http://localhost.:8080/engine-rest/process-instance
# http://localhost.:8080/engine-rest/process-definition
# http://localhost.:8080/engine-rest/user
# http://localhost.:8080/engine-rest/user/demo/profile
def get_tasks
result = RestClient.get BASE_URL
taks = JSON.parse(result)
end
get_tasks.each do |t|
puts "id:#{t['id']}, name:\"#{t['name'].gsub(/(\n|\r)+/, ' ')}\""
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment