OmniBPM Restful API

除了 Organization create/activate/inactivate/delete 這四個 API 傳入的 api_key 是 master api key 以外,其他呼叫傳入的 api 都是 organization 專屬的 API。

基本上所有的物件都有三個 field,idmodelclient_extra

id 是 PK,除了在創建以外必填。

model 只是用來儲存物件型態的欄位,optional 可省略。填了的話系統會 check,如果形態不一致會報錯。

client_extra 可用來存任意的 JSON object 資訊,也是 optional。

另外所有的錯誤都會是以下形式:

{"RESPONSE": "ERR", "RMSG": "Error Message"}

如果正確,一定會有

{"RESPONSE": "OK"}

Organization

List

/api/v0.1/organization/list/

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/organization/list/ \
  -H 'content-type: application/json' \
  -d '{
        "api_key":"MASTER_API_KEY"
}'

Response:

{
    "RESPONSE": "OK",
    "organizations": [
        {
            "abbr": "TEMPLATELIBRARY",
            "name": "temp",
            "__id__": 396
            "api_key": null,
            "is_active": true
        },
        {
            "abbr": "DEMO_EN",
            "name": "Demo",
            "__id__": 397,
            "api_key": null,
            "is_active": true
        }
    ]
}

Create

/api/v0.1/organization/create/

model 此 object 的型態,optional

name 組織名稱

abbr 組織縮寫,全大寫,不可重複

client_extra 可以存任何的 JSON 物件資訊,例如對應PK和optional。

在 organization 外有個額外的參數: default_structure 代表是否建立預設部門與職等。預設值為 true

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/organization/create/ \
  -H 'content-type: application/json' \
  -d '{
    "api_key":"MASTER_API_KEY",
    "organization": {
        "__model__": "Organization",
        "name": "Organization Name",
        "abbr": "ORGNAME",
        "__client_extra__": {"anything":"can be stored here"}
    },
    "default_structure":false
}'

Response:

{
  "RESPONSE": "OK",
  "organization": {
    "api_key": "2faf27efc6b57f0fea4d5c835249d340a3b3d7c1edf3f7bdc4005f15cc0c1eb5",
    "__id__": 11,
    "abbr": "OOO",
    "created_by": null,
    "name": "ooo",
    "__model__": "Organization",
    "is_active": true,
    "__client_extra__": {"anything":"can be stored here"}
  }
}

如果有重複的 organization name:

{"RESPONSE": "ERR", "RMSG": "Duplicate Name."}

Inactivate

/api/v0.1/organization/inactivate/

id 必填,OmniBPM 裡的 Organization PK。

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/organization/inactivate/ \
  -H 'content-type: application/json' \
  -d '{
  "api_key": "MASTER_API_KEY",
  "organization": {
    "__id__": 11
  }
}'

Response:

{
  "RESPONSE": "OK"
}

Activate

/api/v0.1/organization/activate/

id 必填,OmniBPM 裡的 Organization PK。

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/organization/activate/ \
  -H 'content-type: application/json' \
  -d '{
  "api_key": "MASTER_API_KEY",
  "organization": {
    "__id__": 11
  }
}'

Response:

{
  "RESPONSE": "OK"
}

Get

/api/v0.1/organization/get/

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/organization/get/ \
  -H 'content-type: application/json' \
  -d '{
  "api_key": "3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969"
}'

Response:

{
  "RESPONSE": "OK",
  "organization": {
    "is_document_title_editable_by_everyone": true,
    "signed_agreement_by_username": "admin@ORGNAME",
    "login_fail_count_threshold": 5,
    "signed_agreement_by_id": 1034,
    "signed_agreement_by_name": "admin",
    "__model__": "Organization",
    "email_notification_enabled": true,
    "created_by": null,
    "name": "Organization Name",
    "tax_id": null,
    "signed_agreement_version": 0,
    "is_unlimited_plan": false,
    "__client_extra__": {
      "anything": "can be stored here"
    },
    "is_active": true,
    "is_trial_expire_notified": false,
    "is_registration_confirmed": false,
    "registration_date": {
      "__value__": "2017-05-04T00:00:00+08:00",
      "__type__": "datetime"
    },
    "receipt_title": null,
    "__id__": 403,
    "push_notification_enabled": true,
    "azure_tenant_guid": null,
    "api_key": "3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
    "is_paid": false,
    "verified_email": null,
    "azure_login_enabled": false,
    "abbr": "ORGNAME",
    "trial_expire_date": {
      "__value__": "2017-06-04T00:00:00+08:00",
      "__type__": "datetime"
    }
  }
}

Update

/api/v0.1/organization/update/

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/organization/update/ \
  -H 'content-type: application/json' \
  -d '{
  "organization": {
    "name": "new_name",
    "__id__": 403,
    "__client_extra__": {"usage":"just save anything you want to keep"}
  },
  "api_key": "3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969"
}'

Response:

{
  "RESPONSE": "OK",
  "organization": {
    "is_document_title_editable_by_everyone": true,
    "signed_agreement_by_username": "admin@ORGNAME",
    "login_fail_count_threshold": 5,
    "signed_agreement_by_id": 1034,
    "signed_agreement_by_name": "admin",
    "__model__": "Organization",
    "email_notification_enabled": true,
    "created_by": null,
    "name": "Organization Name",
    "tax_id": null,
    "signed_agreement_version": 0,
    "is_unlimited_plan": false,
    "__client_extra__": {
      "anything": "can be stored here"
    },
    "is_active": true,
    "is_trial_expire_notified": false,
    "is_registration_confirmed": false,
    "registration_date": {
      "__value__": "2017-05-04T00:00:00+08:00",
      "__type__": "datetime"
    },
    "receipt_title": null,
    "__id__": 403,
    "push_notification_enabled": true,
    "azure_tenant_guid": null,
    "api_key": "3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
    "is_paid": false,
    "verified_email": null,
    "azure_login_enabled": false,
    "abbr": "ORGNAME",
    "trial_expire_date": {
      "__value__": "2017-06-04T00:00:00+08:00",
      "__type__": "datetime"
    }
  }
}

Delete

/api/v0.1/organization/delete/

傳入的 api_key 為 master api key。

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/organization/delete/ \
  -H 'content-type: application/json' \
  -d '{
        "api_key":"MASTER_API_KEY",
        "organization": {"__id__": 18}
}'

Response:

{
  "RESPONSE": "OK"
}

Import Users

/api/v0.1/organization/importusers/

display_name:必填,顯示用名稱

username:必填,登入用帳號

email:必填

is_external:必填,是否為外部使用者(否)

is_active:必填,是否啟用

department:必填,部門

rank:必填,職等

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/organization/importusers/ \
  -H 'content-type: application/json' \
  -d '{
  "api_key":"3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
  "users": [
    {
      "is_external":false,
      "display_name": "Super New User",
      "username": "new2@ORGNAME",
      "email": "new2@email.com",
      "is_active": true,
      "department": {"__id__": 1921},
      "rank": {"__id__": 1242}
    }
  ]
}'

Response:

{
  "RESPONSE": "OK"
}

Department

department object 大致長這樣:

{
    "organization": {
        ...
    },
    "department_head": null,
    "name": "CEO's Office",
    "is_active": true,
    "parent_department": null,
    "__id__": 1909,
    "__model__": "Department"
}
  • name:部門名稱

  • parent_department:上一層的部門,若為 null 則為最高部門。若非 null 則為 department object。只是此 object 內不會再有 parent_department attribute 一直串上去,最多只會有一層。

  • department_head:部門主管,是一個 User Object。

  • is_active:是否啟用

  • id:OmniBPM 用的 PK

List

/api/v0.1/department/list/

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/department/list/ \
  -H 'content-type: application/json' \
  -d '{
        "api_key":"3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969"
}'

Response:

{
  "RESPONSE": "OK",
  "departments": [
    {
      "organization": {
        ...
      },
      "department_head": null,
      "name": "CEO's Office",
      "is_active": true,
      "parent_department": null,
      "__id__": 1909,
      "__model__": "Department"
    },
    {
      "organization": {
        ...
      },
      "department_head": null,
      "name": "MIS Department",
      "is_active": true,
      "parent_department": {
        "organization_name": "Organization Name",
        "department_head": null,
        "organization_id": 403,
        "name": "CEO's Office",
        "is_active": true,
        "parent_department": null,
        "__id__": 1909,
        "__model__": "Department"
      },
      "__id__": 1910,
      "__model__": "Department"
    },
    {
      "organization": {
        ...
      },
      "department_head": null,
      "name": "Finance Department",
      "is_active": true,
      "parent_department": {
        "organization_name": "Organization Name",
        "department_head": null,
        "organization_id": 403,
        "name": "CEO's Office",
        "is_active": true,
        "parent_department": null,
        "__id__": 1909,
        "__model__": "Department"
      },
      "__id__": 1911,
      "__model__": "Department"
    },
    {
      "organization": {
        ...
      },
      "department_head": null,
      "name": "HR Department",
      "is_active": true,
      "parent_department": {
        "organization_name": "Organization Name",
        "department_head": null,
        "organization_id": 403,
        "name": "CEO's Office",
        "is_active": true,
        "parent_department": null,
        "__id__": 1909,
        "__model__": "Department"
      },
      "__id__": 1912,
      "__model__": "Department"
    },
    {
      "organization": {
        ...
      },
      "department_head": null,
      "name": "Sales Department",
      "is_active": true,
      "parent_department": {
        "organization_name": "Organization Name",
        "department_head": null,
        "organization_id": 403,
        "name": "CEO's Office",
        "is_active": true,
        "parent_department": null,
        "__id__": 1909,
        "__model__": "Department"
      },
      "__id__": 1913,
      "__model__": "Department"
    },
    {
      "organization": {
        ...
      },
      "department_head": null,
      "name": "Purchasing Department",
      "is_active": true,
      "parent_department": {
        "organization_name": "Organization Name",
        "department_head": null,
        "organization_id": 403,
        "name": "CEO's Office",
        "is_active": true,
        "parent_department": null,
        "__id__": 1909,
        "__model__": "Department"
      },
      "__id__": 1914,
      "__model__": "Department"
    }
  ]
}

Create

/api/v0.1/department/create/

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/department/create/ \
  -H 'content-type: application/json' \
  -d '{
    "api_key":"3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
    "department":{
      "organization_id":403,
      "name":"打雜部",
      "parent_department": {"__id__":1910},
      "department_head" : {"__id__":1234}
    }
}'

Response:

{
  "RESPONSE": "OK",
  "department": {
    "organization": {
      ...
    },
    "department_head": null,
    "name": "打雜部",
    "is_active": true,
    "parent_department": {
      "organization_name": "Organization Name",
      "parent_department_id": 1909,
      "organization_id": 403,
      "name": "MIS Department",
      "is_active": true,
      "department_head": {...},
      "__id__": 1910,
      "parent_department_name": "CEO's Office",
      "__model__": "Department"
    },
    "__id__": 1921,
    "__model__": "Department"
  }
}

Inactivate

/api/v0.1/department/inactivate/

此部門必須沒有用戶。若此部門下還有用戶,會回傳 error。

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/department/inactivate/ \
  -H 'content-type: application/json' \
  -d '{
  "api_key": "3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
  "department": {
    "__id__": 1921
  }
}'

Response:

{
  "RESPONSE": "OK"
}

Activate

/api/v0.1/department/activate/

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/department/activate/ \
  -H 'content-type: application/json' \
  -d '{
  "api_key": "3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
  "department": {
    "__id__": 1921
  }
}'

Response:

{
  "RESPONSE": "OK"
}

Update

/api/v0.1/department/update/

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/department/update/ \
  -H 'content-type: application/json' \
  -d '{
  "api_key": "3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
  "department": {
    "name": "新雜事部",
    "department_head": {"__id__":1999},
    "__id__": 1921
  }
}'

Response:

{
  "RESPONSE": "OK",
  "department": {
    "organization_id": 403,
    "__id__": 1921,
    "parent_department_name": "MIS Department",
    "parent_department_id": 1910,
    "__model__": "Department",
    "department_head": { ... },
    "organization": { ... },
    "parent_department": { ... },
    "name": "新雜事部",
    "is_active": false,
    "organization_name": "Organization Name"
  }
}

Delete

/api/v0.1/department/delete/

會檢查是否有子部門,若有,則不能刪除。 另外若流程中有參照到此部門,亦無法刪除。

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/department/delete/ \
  -H 'content-type: application/json' \
  -d '{
        "api_key":"3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
        "department":{"__id__": 1921}
}'

Response:

{
  "RESPONSE": "OK"
}

Rank

{
  "organization": { ... },
  "level": 4,
  "name": "Specialist",
  "is_active": true,
  "__id__": 1234,
  "__model__": "UserRank"
}
  • level 職等,數字越小越高層

  • name 職等名稱

List

/api/v0.1/rank/list/

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/rank/list/ \
  -H 'content-type: application/json' \
  -d '{
        "api_key":"3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969"
}'

Response:

{
  "RESPONSE": "OK",
  "ranks": [
    {
      "organization": {
        ...
      },
      "level": 1,
      "name": "Executive Officer",
      "is_active": true,
      "__id__": 1231,
      "__model__": "UserRank"
    },
    {
      "organization": {
        ...
      },
      "level": 2,
      "name": "Director",
      "is_active": true,
      "__id__": 1232,
      "__model__": "UserRank"
    },
    {
      "organization": {
        ...
      },
      "level": 3,
      "name": "Manager",
      "is_active": true,
      "__id__": 1233,
      "__model__": "UserRank"
    },
    {
      "organization": {
        ...
      },
      "level": 4,
      "name": "Specialist",
      "is_active": true,
      "__id__": 1234,
      "__model__": "UserRank"
    }
  ]
}

Create

/api/v0.1/rank/create/

level 必填,且不能和現有的 level 重複,否則會有 error。

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/rank/create/ \
  -H 'content-type: application/json' \
  -d '{
  "api_key":"3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
  "rank":{
    "name": "打雜的",
    "level": 10
  }
}'

Response:

{
  "RESPONSE": "OK",
  "rank": {
    "organization": {
      ...
    },
    "level": 10,
    "name": "打雜的",
    "is_active": true,
    "__id__": 1242,
    "__model__": "UserRank"
  }
}

若 level 有重複,會有錯誤:

{
  "RESPONSE": "ERR",
  "RMSG": "Duplicate Name."
}

Inactivate

/api/v0.1/rank/inactivate/

停用職等,讓 is_activefalse。已停用職等仍會出現在 list 的 API 內,通常畫面的呈現是用 strike 來表達。停用職等不會改變 level 的值。

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/rank/inactivate/ \
  -H 'content-type: application/json' \
  -d '{
  "api_key": "3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
  "rank": {
    "__id__": 1242
  }
}'

Response:

{
  "RESPONSE": "OK"
}

若還有使用者在此職等,停用會發生錯誤。必須先把 user 指定為別的職等,才能停用。

{
  "RMSG": "Trying to delete a non-empty user rank",
  "RESPONSE": "ERR"
}

Activate

/api/v0.1/rank/activate/

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/rank/activate/ \
  -H 'content-type: application/json' \
  -d '{
  "api_key": "3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
  "rank": {
    "__id__": 1242
  }
}'

Response:

{
  "RESPONSE": "OK"
}

Update

/api/v0.1/rank/update/

沒辦法改 level,只能改 name。要改 level 要用 rank/order API。

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/rank/update/ \
  -H 'content-type: application/json' \
  -d '{
  "api_key":"3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
  "rank":{
    "__id__": 1242,
    "name": "新打雜職等"
  }
}'

Response:

{
  "RESPONSE": "OK",
  "rank": {
    "organization": {
      ...
    },
    "level": 10,
    "name": "新打雜職等",
    "is_active": true,
    "__id__": 1242,
    "__model__": "UserRank"
  }
}

Delete

/api/v0.1/rank/delete/

會檢查是否有 User 屬於此職等。若有則無法刪除。 會檢查流程中是否有參照到此職等,若有則無法刪除。

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/rank/delete/ \
  -H 'content-type: application/json' \
  -d '{
        "api_key":"3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
        "rank":{"__id__": 1242}
}'

Response:

{
  "RESPONSE": "OK"
}

Order

/api/v0.1/rank/order/

調整職等的層級。rank_order 傳入職等陣列,越前面的職等越高級(level 越小)。已停用的職等也必須傳入。

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/rank/order/ \
  -H 'content-type: application/json' \
  -d '{
  "api_key":"3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
  "rank_order": [
    {"__id__": 1234},
    {"__id__": 1232},
    {"__id__": 1231},
    {"__id__": 1233},
    {"__id__": 1242}
  ]
}'

Response:

{
  "RESPONSE": "OK"
}

若傳來的 rank_order 有漏掉任何一個 rank,會出現錯誤

{
  "RESPONSE": "ERR",
  "RMSG": "Missing ranks in the order list."
}

User

{
  "__model__": "UserProfile",
  "is_active": true,
  "is_external": false,
  "username": "hello@ORGNAME",
  "email": "hello@email.com",
  "display_name": "John Cena",
  "__id__": 1037,
  "organization": { ... },
  "organization_name": "Organization Name",
  "organization_id": 403,
  "rank": { ... },
  "rank_name": "Specialist",
  "rank_id": 1234,
  "department": { ... },
  "department_name": "MIS",
  "department_id": 1922,
  "__client_extra__": {}
}

基本結構如上,會有一些額外的欄位(例如 azure_* 是和微軟登入相關的)用不到可先忽略。主要用到的欄位有:

  • username 必須是 login@org.abbr 的形式,org.abbr 為大寫。

  • display_name 顯示用的全名

  • email

  • is_active 是否為有效使用者,true

  • is_external 是否為外部使用者。MDS 的情境下都填 false 即可。

  • id PK

  • rank 職等

  • department 部門

List

/api/v0.1/user/list/

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/user/list/ \
  -H 'content-type: application/json' \
  -d '{
        "api_key":"3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969"
}'

Response:

{
  "users": [
    {
      "__model__": "UserProfile",
      "is_active": true,
      "is_external": false,
      "username": "hello@ORGNAME",
      "email": "hello@email.com",
      "display_name": "John Cena",
      "__id__": 1037,
      "misc_data": "",
      "organization": { ... },
      "organization_name": "Organization Name",
      "organization_id": 403,
      "rank": { ... },
      "rank_name": "Specialist",
      "rank_id": 1234,
      "department": { ... },
      "department_name": "MIS",
      "department_id": 1922
    }
  ],
  "RESPONSE": "OK"
}

Create

/api/v0.1/user/create/

目前 rank 和 department 雖然是必須的,但若沒傳會自動帶入 default 值。 rank / department 改為必填欄位。 with_admin_permissions: 若為 true 則建立的使用者進入網頁後台可以管理組織等。

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/user/create/ \
  -H 'content-type: application/json' \
  -d '{
        "api_key":"3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
        "user":{
            "username":"alejandro@ORGNAME",
            "email":"alejandro@email.com",
            "password":"123456",
            "display_name":"Alejandro Valverde",
            "rank": {"__id__": 1234},
            "department": {"__id__": 1922},
            "__client_extra__":{"save":"anything"}
        }
}'

Response:

{
  "user": {
    "organization_id": 403,
    "is_active": true,
    "rank_name": "Specialist",
    "display_name": "Alejandro Valverde",
    "department_name": "MIS",
    "__id__": 1042,
    "organization": { ... },
    "username": "alejandro@ORGNAME",
    "email": "alejandro@email.com",
    "__client_extra__": {
      "save": "anything"
    },
    "__model__": "UserProfile",
    "is_external": false,
    "organization_name": "Organization Name",
    "rank": { ... },
    "rank_id": 1234,
    "department": { ... },
    "department_id": 1922
  },
  "RESPONSE": "OK"
}

Inactivate

/api/v0.1/user/inactivate/

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/user/inactivate/ \
  -H 'content-type: application/json' \
  -d '{
  "api_key": "3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
  "user": {"__id__": 1036}
}'

Response:

{"RESPONSE": "OK"}

Activate

/api/v0.1/user/activate/

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/user/activate/ \
  -H 'content-type: application/json' \
  -d '{
  "api_key": "3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
  "user": {"__id__": 1036}
}'

Response:

{"RESPONSE": "OK"}

Update

/api/v0.1/user/update/

能修改的欄位只有

  • rank

  • department (若為已停用 department,會發生錯誤)

  • display_name

  • email

  • password

  • is_active (功能相當於 user/activateuser/inactivate

  • client_extra

Request:

{
  "api_key":"3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
    "user": {
      "display_name": "Alejandro Valverde Belmonte",
      "__id__": 1042,
      "email": "balaverde@email.com",
      "__client_extra__": {
        "save": "anything updated"
      }
  }
}

Response:

{
  "user": {
    "organization_id": 403,
    "rank_name": "Specialist",
    "organization_name": "Organization Name",
    "organization": { ... },
    "__client_extra__": {
      "save": "anything updated"
    },
    "department_id": 1922,
    "rank_id": 1234,
    "rank": { ... },
    "__model__": "UserProfile",
    "department": { ... },
    "display_name": "Alejandro Valverde Belmonte",
    "__id__": 1042,
    "department_name": "MIS",
    "username": "alejandro@ORGNAME",
    "email": "balaverde@email.com",
    "is_external": false,
    "is_active": true,
  },
  "RESPONSE": "OK"
}

Delete

/api/v0.1/user/delete/

會檢查流程中是否有參照到此 User,若有則無法刪除。 (群組參照到的話可以刪除,刪除後群組少一位成員)

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/user/delete/ \
  -H 'content-type: application/json' \
  -d '{
        "api_key":"3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
        "user":{"__id__": 1042}
}'

Response:

{
  "RESPONSE": "OK"
}

Error: (若該 User 為部門主管時無法刪除)

{
  "RESPONSE": "ERR",
  "RMSG": "Cannot delete user who is the head of <QuerySet [<Department: MIS>]>"
}

Group

{
      "organization_id": 403,
      "__id__": 755,
      "__model__": "GroupProfile",
      "organization": { ... },
      "organization_name": "Organization Name",
      "is_active": true,
      "name": "All Users"
}

每個組織預設會有兩個群組,All UsersExternal Users。這兩個群組內容是系統產生,無法編輯。

若要取得/修改群組內的用戶列表,需要呼叫 /api/v0.1/group/user/list//api/v0.1/group/user/add//api/v0.1/group/user/remove/

List

/api/v0.1/group/list/

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/group/list/ \
  -H 'content-type: application/json' \
  -d '{
        "api_key":"3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969"
}'

Response:

{
  "groups": [
    {
      "organization_id": 403,
      "__id__": 755,
      "__model__": "GroupProfile",
      "organization": { ... },
      "organization_name": "Organization Name",
      "is_active": true,
      "name": "All Users"
    },
    {
      "organization_id": 403,
      "__id__": 756,
      "__model__": "GroupProfile",
      "organization": { ... },
      "organization_name": "Organization Name",
      "is_active": true,
      "name": "External Users"
    }
  ],
  "RESPONSE": "OK"
}

Create

/api/v0.1/group/create/

name 同一個組織下的 name 必須是唯一值,不可重複。不同組織則可重複。

users 欲加入此群組的人員列表,optional。

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/group/create/ \
  -H 'content-type: application/json' \
  -d '{
  "api_key":"3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
  "group":{"name":"B工作小組"},
  "users":[{"__id__": 10}, {"__id__": 12}]
}'

Response:

{
  "group": {
    "is_active": true,
    "organization_id": 403,
    "__model__": "GroupProfile",
    "organization": { ... },
    "name": "B工作小組",
    "organization_name": "Organization Name",
    "__id__": 764
  },
  "RESPONSE": "OK"
}

Inactivate

/api/v0.1/group/inactivate/

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/group/inactivate/ \
  -H 'content-type: application/json' \
  -d '{
  "api_key": "3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
  "group": {"__id__": 764}
}'

Response:

{"RESPONSE": "OK"}

Activate

/api/v0.1/group/activate/

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/group/activate/ \
  -H 'content-type: application/json' \
  -d '{
  "api_key": "3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
  "group": {"__id__": 764}
}'

Response:

{"RESPONSE": "OK"}

Update

/api/v0.1/group/update/

只能改name,如果值沒有更新會有 error。 is_active (功能相當於 group/activategroup/inactivate

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/group/update/ \
  -H 'content-type: application/json' \
  -d '{
  "api_key": "3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
  "group": {"__id__": 764, "name":"C工作小組"}
}'

Response:

{"RESPONSE": "OK"}

如果傳入值是原本的 name 會遇到 error

{
   "RMSG" : "Internal server error, please report the bug to service@omnibpm.com",
   "REASON" : "'name'",
   "RESPONSE" : "ERR"
}

Delete

/api/v0.1/group/delete/

刪除群組。

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/group/delete/ \
  -H 'content-type: application/json' \
  -d '{
  "api_key":"761533a4119c437cf5531d9de6a1f7c6008512871a0c4339eda7caa246ab28a3",
  "group":{"__id__":15}
}'

Response:

{
    "RESPONSE": "OK"
}

User List

/api/v0.1/group/user/list/

列出群組的成員。

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/group/user/list/ \
  -H 'content-type: application/json' \
  -d '{
        "api_key":"3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
        "group":{"__id__":764}
}'

Response:

{
  "users": [
    {
      "department": { ... },
      "department_name": "MIS",
      "rank": { ... },
      "is_active": true,
      "username": "hello@ORGNAME",
      "display_name": "John Cena",
      "organization_name": "Organization Name",
      "organization_id": 403,
      "email": "hello@email.com",
      "rank_id": 1234,
      "rank_name": "Specialist",
      "department_id": 1922,
      "is_external": false,
      "organization": { ... },
      "__id__": 1037,
    }
  ],
  "RESPONSE": "OK"
}

User Add

/api/v0.1/group/user/add/

不能把 user 加入 All UsersExternal Users 群組,也不能加入inactive的群組。結果會回傳目前群組的所有成員。

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/group/user/add/ \
  -H 'content-type: application/json' \
  -d '{
        "api_key":"3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
        "group":{"__id__":764},
        "users":[
                {"__id__":1040}
        ]
}'

Response:

{
  "users": [
    {
      "department": { ... },
      "department_name": "MIS",
      "rank": { ... },
      "is_active": true,
      "username": "hello@ORGNAME",
      "display_name": "John Cena",
      "organization_name": "Organization Name",
      "organization_id": 403,
      "email": "hello@email.com",
      "rank_id": 1234,
      "rank_name": "Specialist",
      "department_id": 1922,
      "is_external": false,
      "organization": { ... },
      "__id__": 1037
    },
    {
      "department": { ... },
      "department_name": "MIS",
      "rank": { ... },
      "is_active": true,
      "username": "contador@ORGNAME",
      "display_name": "Alberto Contador",
      "organization_name": "Organization Name",
      "organization_id": 403,
      "email": "contador@email.com",
      "rank_id": 1234,
      "rank_name": "Specialist",
      "department_id": 1922,
      "is_external": false,
      "organization": { ... },
      "__id__": 1040
    }
  ],
  "RESPONSE": "OK"
}

User Remove

/api/v0.1/group/user/remove/

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/group/user/remove/ \
  -H 'content-type: application/json' \
  -d '{
        "api_key":"3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
        "group":{"__id__":764},
        "users":[
                {"__id__":1040},
                {"__id__":1037}
        ]
}'

Response:

{
  "users": [],
  "RESPONSE": "OK"
}

Workflow

{
    "name": "測試流程",
    "is_complete": false,
    "organization": { ... },
    "__id__": 1,
    "version": 0,
    "is_active": false,
    "organization_id": 403,
    "organization_name": "Organization Name"
}

流程的 object 內有幾個重要的 attribute,其中 name 是唯一識別,不能重複。

is_complete 之前,流程都可新增刪除節點,但呼叫 workflow/finalize 後,is_complete 會變成 true。此時就不能再新增刪除節點。只能呼叫 workflow/clone 產生一個新版本來修改。

同樣名字的流程可以有好幾個版本, version 數字越大的版本越新。

不同版本的流程之間,最多只能有一個是 is_active 的流程。

Create

/api/v0.1/workflow/create/

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/workflow/create/ \
  -H 'content-type: application/json' \
  -d '{
        "apikey": "3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
        "workflow": {
                "name": "測試流程"
        }
}'

Response:

{
  "workflow": {
    "name": "測試流程",
    "is_complete": false,
    "organization": { ... },
    "__id__": 1,
    "version": 0,
    "is_active": false,
    "organization_id": 403,
    "organization_name": "Organization Name"
  },
  "RESPONSE": "OK"
}

name 是唯一值,若傳入已存在的流程名字,會產生錯誤:

{
  "RMSG": "Duplicate Name.",
  "RESPONSE": "ERR"
}

Clone

/api/v0.1/workflow/clone/

產生一個可以修改的新版本。產生出來的流程 version 會大於所有同名流程的 version,並且可以編輯(is_complete == false)。

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/workflow/clone/ \
  -H 'content-type: application/json' \
  -d '{
        "apikey": "3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
        "from_workflow":{"__id__": 1}
}'

Response:

{
  "workflow": {
    "name": "測試流程",
    "is_complete": false,
    "organization": { ... },
    "__id__": 2,
    "version": 1,
    "is_active": false,
    "organization_id": 403,
    "organization_name": "Organization Name"
  },
  "RESPONSE": "OK"
}

Save As

/api/v0.1/workflow/save_as/

將目前流程另存成一個新的名字的流程。

workflow: Workflow object, 被另存的流程。

new_name: String, 新流程的名字。

Request:

curl -X "POST" "https://demo.omnibpm.com/api/v0.1/workflow/save_as/" \
     -H "Content-Type: application/json" \
     -d '{
  "workflow": {
    "__id__": 2
  },
  "new_name": "APPLE",
  "apikey": "761533a4119c437cf5531d9de6a1f7c6008512871a0c4339eda7caa246ab28a3"
}'

Response:

{
  "RESPONSE": "OK",
  "workflow": {
    "is_complete": true,
    "__model__": "WorkflowDTO",
    "__id__": 11,
    "organization": { ... },
    "is_active": true,
    "name": "APPLE",
    "version": 0,
    "is_hidden": false,
    "organization_id": 1,
    "organization_name": "Hypo"
}

List

/api/v0.1/workflow/list/

name: String, optional. 如果有提供的話,只會顯示該名稱的流程。若無提供,顯示全部的流程。

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/workflow/list/ \
  -H 'content-type: application/json' \
  -d '{
        "apikey": "3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969"
}'

Response:

{
  "workflows": [
    {
      "name": "測試流程",
      "is_complete": false,
      "organization": { ... },
      "__id__": 2,
      "version": 1,
      "is_active": false,
      "organization_id": 403,
      "organization_name": "Organization Name"
    },
    {
      "name": "測試流程",
      "is_complete": false,
      "organization": { ... },
      "__id__": 1,
      "version": 0,
      "is_active": false,
      "organization_id": 403,
      "organization_name": "Organization Name"
    }
  ],
  "RESPONSE": "OK"
}

Update

/api/v0.1/workflow/update/

只能修改 name 屬性。原本同名的其他 workflow 也會一併被修改。

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/workflow/update/ \
  -H 'content-type: application/json' \
  -d '{
        "apikey": "b0a771b0f98d6f6c66b87712f71131660b58e3283d2bbaac2fde3c6e4b2c8a1c",
        "workflow": {
                "__id__": 5,
                "name": "新流程名稱"
        }
}'

Response:

{
    "RESPONSE": "OK",
    "workflow": {
        "is_active": false,
        "version": 0,
        "organization_id": 414,
        "organization": { ... },
        "name": "新流程名稱",
        "__id__": 5,
        "is_complete": false
    }
}

Finalize

/api/v0.1/workflow/finalize/

完成編輯節點,呼叫後 is_complete 會變成 true,並且流程不能再編輯。

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/workflow/finalize/ \
  -H 'content-type: application/json' \
  -d '{
        "apikey": "3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
        "workflow": { "__id__": 2 }
}'

Response:

{
  "workflow": {
    "name": "測試流程",
    "is_complete": true,
    "organization": { ... },
    "__id__": 2,
    "version": 1,
    "is_active": false,
    "__model__": "WorkflowDTO",
    "organization_id": 403,
    "organization_name": "Organization Name"
  },
  "RESPONSE": "OK"
}

Activate

/api/v0.1/workflow/activate/

將流程設為現行流程(可以建立新的 document),呼叫後 is_active 會是 true,並且把其他版本的流程設為 is_active == false

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/workflow/activate/ \
  -H 'content-type: application/json' \
  -d '{
        "apikey": "3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
        "workflow": { "__id__": 2 }
}'

Response:

{
  "workflow": {
    "name": "測試流程",
    "is_complete": true,
    "organization": { ... },
    "__id__": 2,
    "version": 1,
    "is_active": true,
    "organization_id": 403,
    "organization_name": "Organization Name"
  },
  "RESPONSE": "OK"
}

Inactivate

/api/v0.1/workflow/inactivate/

將流程設為失效(is_active == false,不能創立新文件)。

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/workflow/inactivate/ \
  -H 'content-type: application/json' \
  -d '{
        "apikey": "3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
        "workflow": { "__id__": 2 }
}'

Response:

{
  "workflow": {
    "name": "測試流程",
    "is_complete": true,
    "organization": { ... },
    "__id__": 2,
    "version": 1,
    "is_active": false,
    "organization_id": 403,
    "organization_name": "Organization Name"
  },
  "RESPONSE": "OK"
}

Hide

/api/v0.1/workflow/hide/

隱藏流程。隱藏後 list 不會被列出來。

Request:

curl -X "POST" "https://demo.omnibpm.com/api/v0.1/workflow/hide/" \
     -H "Content-Type: application/json" \
     -d '{
  "workflow": {
    "__id__": 8
  },
  "apikey": "761533a4119c437cf5531d9de6a1f7c6008512871a0c4339eda7caa246ab28a3"
}'

Response:

{
  "RESPONSE": "OK"
}

Delete

/api/v0.1/workflow/delete/

刪除流程,有產生過文件的流程不能刪除。

Request:

## workflow/delete/
curl -X "POST" "https://demo.omnibpm.com/api/v0.1/workflow/delete/" \
     -H 'Content-Type: application/json' \
     -d $'{
  "workflow": {
    "__id__": 89
  },
  "apikey": "761533a4119c437cf5531d9de6a1f7c6008512871a0c4339eda7caa246ab28a3"
}'

Response:

{
  "RESPONSE": "OK"
}

Workflow Permission

一個 workflow 權限可以針對

  • user:使用者

  • group:群組

  • department:部門

(以上對象擇一)分別設定

  • is_creatable:是否可建立文件

  • is_visible:是否可以看到所有(他人)文件

  • is_revokable:是否可撤銷文件

  • is_revivable:是否可退回已完成文件(狀態更改為``進行中'')

(以上權限可同時存在)

權限是所有版本共用一個的,所以如果新版流程修改權限後,舊版也會被影響。

{
  "is_revokable": false,
  "is_creatable": true,
  "is_visible": true,
  "is_revivable": false,
  "group": { ... }
}

List

/api/v0.1/workflow_perm/list/

列出某流程的權限。

  • workflow: Workflow object. 列出該流程的權限設定。

輸出格式如 workflow_perm/set/

Request:

## workflow_perm/list/
curl -X "POST" "https://demo.omnibpm.com/api/v0.1/workflow_perm/list/" \
     -H 'Content-Type: application/json' \
     -d $'{
  "workflow": {
    "__id__": 102
  },
  "apikey": "761533a4119c437cf5531d9de6a1f7c6008512871a0c4339eda7caa246ab28a3"
}'

Response:

{
  "RESPONSE": "OK",
  "revivable_users": [],
  "visible_groups": [],
  "visible_departments": [],
  "creatable_departments": [],
  "revivable_groups": [],
  "revokable_groups": [],
  "creatable_groups": [
    { ... }
  ],
  "creatable_users": [],
  "revokable_users": [],
  "revivable_departments": [],
  "visible_users": [],
  "revokable_departments": []
}

Set

/api/v0.1/workflow_perm/set/

設定權限

  • workflow:Workflow object. 對某個流程設定權限。

權限設定:

  • creatable_users:Array of User objects.

  • visible_users:Array of User objects.

  • revokable_users:Array of User objects.

  • revivable_users:Array of User objects.

  • creatable_groups:Array of Group objects.

  • visible_groups:Array of Group objects.

  • revokable_groups:Array of Group objects.

  • revivable_groups:Array of Group objects.

  • creatable_departments:Array of Department objects.

  • visible_departments:Array of Department objects.

  • revokable_departments:Array of Department objects.

  • revivable_departments:Array of Department objects.

以上權限陣列若無提供,將視為清除。因此只要全都不傳或者傳空陣列,就會將權限全部清空。

Request:

## workflow_perm/set/
curl -X "POST" "https://demo.omnibpm.com/api/v0.1/workflow_perm/set/" \
     -H 'Content-Type: application/json' \
     -d $'{
  "workflow": { "__id__": 102 },
  "revokable_groups": [
    { "__id__": 1 }
  ],
  "apikey": "761533a4119c437cf5531d9de6a1f7c6008512871a0c4339eda7caa246ab28a3",
  "visible_users": [
    { "__id__": 19 },
    { "__id__": 2 }
  ],
  "creatable_users": [
    { "__id__": 2 }
  ]
}'

Response:

{"RESPONSE": "OK"}

Delete

/api/v0.1/workflow_perm/delete/

刪除某人/群組/部門對某流程的所有權限。此 API 一次只能刪除一個對象的權限。

  • workflow

以下對象只能擇一填寫:

  • user

  • group

  • department

Request:

## workflow_perm/delete/
curl -X "POST" "https://demo.omnibpm.com/api/v0.1/workflow_perm/delete/" \
     -H 'Content-Type: application/json' \
     -d $'{
  "workflow": {
    "__id__": 102
  },
  "user": {
    "__id__": 19
  },
  "apikey": "761533a4119c437cf5531d9de6a1f7c6008512871a0c4339eda7caa246ab28a3"
}'

Response:

{"RESPONSE": "OK"}

Workflow Node

節點的結構比較複雜,不同的 type 會有不同欄位。

必填欄位:

n_sign:此節點要被多少人簽過才算完成

note:節點名稱

以下欄位不能同時存在,按照「誰可以簽」來分類,必須選一種。

  • 部門

    • department:型態為 Department 的 JSON object,只要 id key 存在即可。

  • 群組

    • group:型態為 Group 的 JSON object,只要 id key 存在即可。

  • 使用者

    • user:型態為 User 的 JSON object,只要 id key 存在即可。

  • 主管簽核(設定要簽到哪種職等)

    • rank:型態為 Rank 的 JSON object,只要 id key 存在即可。

    • reference_node:主管參考點,若為 null 代表參考流程發起人,否則參考簽 reference_node 的人

    • sign_by_at_least_one_supervisor:預設值為 true,至少需要一位主管核准(就算職等已高於要求)

  • 流程發起人

    • as_doc_creator: true

  • 待指定負責人

    • as_specified: true

    • job_assignment_node:在哪個 node 指定簽核者。型態為 Workflow Node 的 JSON Object,只要 id key 存在即可。

    • job_assignment_type:字串,有兩種值:

      • ASSIGN:代表由 job_assignment_node 的簽核者負責指定

      • COPY:代表和 job_assignment_node 的簽核者同步,此時 job_assignment_node 必須也是「待指定負責人」才行,否則會有錯誤。

除了「待指定負責人」的節點以外,其他種類節點的 job_assignment_nodejob_assignment_type 都是 optional,填 null 和 empty string 代表「不需指定負責人」。而唯有「群組」節點支援「同步簽核者」(job_assignment_type == COPY ),且被參照的 job_assignment_node 也要是群組節點並且屬於同樣群組才行。

以下參數非必填:

require_all_cc_response:要所有 CC 使用者都回覆了以後才會繼續下一個節點,預設為 false

allow_cc:允許 CC,預設為 true

allowed_cc_departments:Array of Department Objects,代表這些部門裡的人都可以被 CC。

allowed_cc_groups:Array of Group Objects,代表這些群組裡的人都可以被 CC。

allowed_cc_users:Array of User Objects,代表這些人都可以被 CC。

autocomplete_condition:String,跳過條件(公式)。條件為真時,跳過此節點不執行。

autocomplete_deadline:Int,秒數。期限過後自動跳過此節點。

如果都沒有填寫,預設 allowed_cc_groups 為 ``All Users'' 群組。

required_fields:「必填的欄位」,Array of Workflow Field,若沒填預設為空。

editable_fields:「可編輯的欄位」,Array of Workflow Field,若沒填預設為空。

visible_fields:「可見的欄位」,Array of Workflow Field,若沒填預設為目前流程內全部欄位。至少要可以看到一個欄位,不能傳空陣列。

「必填欄位」也一定「可編輯」和「可見」,「可編輯」欄位一定「可見」。 若更新 required_fields:[f1], editable_fields:[f2], visible_fields[f3],結果會是 required_fields:[f1], editable_fields[f1, f2], visible_fields[f1, f2, f3]

以下欄位透過特殊 API 操作: children_set:Array of Workflow Node JSON object. 代表子節點。透過 workflow_node/add_childworkflow_node/remove_child 增減。

以下欄位唯讀: node_type:值為 department, user, group, userrank 四種。其中「流程發起人」和「待指定負責人」都是 user 型態。

Create

/api/v0.1/workflow_node/create/

1.產生待指定負責人節點

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/workflow_node/create/ \
  -H 'content-type: application/json' \
  -d '{
  "apikey": "3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
  "workflow": {"__id__": 2 },
  "node":{
    "note":"待指定負責人節點",
    "as_specified": true,
    "job_assignment_node": {"__id__": 21 },
    "job_assignment_type": "ASSIGN",
    "n_sign": 1,
    "visible_fields": [{"__id__": 404}],
    "editable_fields": [{"__id__": 405}],
    "required_fields": [{"__id__": 406}]
  }
}'

Response:

{
    "node": {
        "node_type": "user",
        "job_assignment_node": { ... },
        "n_sign": 1,
        "allowed_cc_groups": [],
        "allowed_cc_users_ids": [],
        "children_set_ids": [],
        "job_assignment_node_id": 21,
        "user": null,
        "note": "待指定負責人節點",
        "as_doc_creator": false,
        "allowed_cc_users": [],
        "organization_id": 10,
        "allowed_cc_departments": [],
        "allowed_cc_departments_ids": [],
        "require_all_cc_response": false,
        "job_assignment_type": "ASSIGN",
        "organization": { ... },
        "is_active": true,
        "is_complete": false,
        "allowed_cc_groups_ids": [],
        "organization_name": "Organization Name",
        "allow_cc": true,
        "__id__": 98,
        "children_set": [],
        "as_specified": true,
        "autocomplete_condition": null
    },
    "RESPONSE": "OK"
}

2.產生文件發起人節點:

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/workflow_node/create/ \
  -H 'content-type: application/json' \
  -d '{
  "apikey": "3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
  "workflow": {"__id__": 2 },
  "node":{
    "note":"發起人節點",
    "as_doc_creator": true,
    "n_sign": 1
  }
}'

3.產生 User 節點

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/workflow_node/create/ \
  -H 'content-type: application/json' \
  -d '{
  "apikey": "3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
  "workflow": {"__id__": 2 },
  "node":{
    "note": "user節點",
    "user": {"__id__": 16},
    "n_sign": 1
  }
}'

4.部門節點

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/workflow_node/create/ \
  -H 'content-type: application/json' \
  -d '{
  "apikey": "3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
  "workflow": {"__id__": 2 },
  "node":{
    "note": "部門節點",
    "department": {"__id__": 40},
    "n_sign": 1
  }
}'

5.群組節點

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/workflow_node/create/ \
  -H 'content-type: application/json' \
  -d '{
  "apikey": "3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
  "workflow": {"__id__": 2 },
  "node":{
    "note": "群組節點",
    "group": {"__id__": 30},
    "n_sign": 1
  }
}'

6.主管簽核節點(流程發起人的主管)

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/workflow_node/create/ \
  -H 'content-type: application/json' \
  -d '{
  "apikey": "3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
  "workflow": {"__id__": 2 },
  "node":{
    "note": "主管簽核節點(發起人)",
    "rank": {"__id__": 4},
    "reference_node": null,
    "n_sign": 1
  }
}'

List

/api/v0.1/workflow_node/list/

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/workflow_node/list/ \
  -H 'content-type: application/json' \
  -d '{
      "apikey":"3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
      "workflow":{"__id__": 2}
}'

Response:

 {
    "RESPONSE": "OK",
    "nodes": [
        {
            "group": { ... },
            "allowed_cc_groups": [],
            "is_active": true,
            "children_set_ids": [],
            "__id__": 71,
            "organization_id": 10,
            "allowed_cc_departments_ids": [],
            "require_all_cc_response": false,
            "node_type": "group",
            "n_sign": 1,
            "organization_name": "Organization Name",
            "group_name": "10_coolgroup",
            "is_complete": false,
            "allow_cc": true,
            "job_assignment_node": { ... },
            "job_assignment_type": "ASSIGN",
            "min_rank": null,
            "__model__": "ProcessFlowNode",
            "deadline": 0,
            "children_set": [],
            "autocomplete_condition": null,
            "trigger_workflow": null,
            "organization": { ... },
            "job_assignment_node_id": 21,
            "trigger_workflow_field_content": {},
            "allowed_cc_users": [],
            "group_id": 18,
            "allowed_cc_groups_ids": [],
            "allowed_cc_users_ids": [],
            "allowed_cc_departments": [],
            "autocomplete_deadline": 0,
            "max_rank": null,
            "note": "群組節點"
        },
        { ... },
        { ... },
        { ... }
    ]
}

Delete

/api/v0.1/workflow_node/delete/

若刪除的節點有指定別的節點的負責人,刪除會出錯。

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/workflow_node/delete/ \
  -H 'content-type: application/json' \
  -d '{
  "api_key": "3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
  "node": {
    "__id__": 101
  }
}'

Response:

{
    "RESPONSE": "OK"
}

Update

/api/v0.1/workflow_node/update/

workflow_node/create 能傳的參數一樣,唯獨多了 id 指定要修改哪個節點。

注意 此 method 內部的實作為砍掉原本的節點,並且產生一個新的節點取代。節點間的連結關係會維持,因此要注意回傳的 id 一定和傳入不同。

建議只在同樣的節點類型內修改。例如:部門節點修改部門是安全的,但不建議將部門節點修改為群組節點(尚未測試會發生什麼事)。

回傳:

node:修改過後的 Node 節點

job_assigned_nodes_ids:Array of Integer. 所有由該節點指定簽核者的節點 ID

referenced_nodes_ids:Array of Integer. 所有參考該節點的節點 ID

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/workflow_node/update/ \
  -H 'content-type: application/json' \
  -d '{
  "apikey": "b0a771b0f98d6f6c66b87712f71131660b58e3283d2bbaac2fde3c6e4b2c8a1c",
  "node":{
          "__id__": 10414,
    "note":"New Name"
  }
}'

Response:

{
    "job_assigned_nodes_ids": [456],
    "referenced_nodes_ids": [123],
    "node": {
        "allowed_cc_users": [],
        "allowed_cc_departments_ids": [],
        "require_all_cc_response": false,
        "trigger_workflow_field_content": {},
        "trigger_workflow": null,
        "autocomplete_deadline": 0,
        "autocomplete_condition": null,
        "job_assignment_node": null,
        "organization": { ... },
        "user": null,
        "note": "New Name",
        "allowed_cc_groups_ids": [],
        "allow_cc": true,
        "children_set_ids": [],
        "__id__": 10415,
        "allowed_cc_groups": [],
        "n_sign": 1,
        "allowed_cc_users_ids": [],
        "children_set": [],
        "is_active": true,
        "node_type": "user",
        "is_notifying_member_on_enter": false,
        "organization_id": 414,
        "allowed_cc_departments": [],
        "deadline": 0,
        "organization_name": "YSL",
        "as_specified": false,
        "as_doc_creator": true,
        "is_complete": false,
        "job_assignment_type": ""
    },
    "RESPONSE": "OK"
}

Add Child

/api/v0.1/workflow_node/add_child/

建立節點之間的連結。

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/workflow_node/add_child/ \
  -H 'content-type: application/json' \
  -d '{
  "api_key": "3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
  "node": { "__id__": 100 },
  "child": { "__id__": 99 }
}'

Response:

{
    "RESPONSE": "OK",
    "node": {
        "children_set_ids": [99],
        "children_set": [
            {
                "job_assignment_node": null,
                "job_assignment_type": "",
                "as_specified": false,
                "__model__": "ProcessFlowNode",
                "deadline": 0,
                "is_active": true,
                "children_set_ids": [],
                "__id__": 99,
                "autocomplete_condition": null,
                "trigger_workflow": null,
                "organization_id": 10,
                "allowed_cc_departments_ids": [],
                "require_all_cc_response": false,
                "node_type": "user",
                "allowed_cc_groups_ids": [],
                "as_doc_creator": true,
                "allowed_cc_users_ids": [],
                "user": null,
                "n_sign": 1,
                "organization_name": "hypo",
                "autocomplete_deadline": 0,
                "is_complete": false,
                "trigger_workflow_field_content": {},
                "allow_cc": true,
                "note": "發起人節點"
            }
        ],
        ... (其他屬性不變)
    }
}

Remove Child

/api/v0.1/workflow_node/remove_child/

刪除節點間的連結

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/workflow_node/remove_child/ \
  -H 'content-type: application/json' \
  -d '{
  "api_key": "3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
  "node": { "__id__": 100 },
  "child": { "__id__": 99 }
}'

Response:

{
    "RESPONSE": "OK",
    "node": {
        "children_set_ids": [],
        "children_set": [],
        ... (其他屬性不變)
    }
}

Workflow Field

{
        "organization_id": 10,
        "data_type": "UTF8",
        "is_active": true,
        "__id__": 55,
        "organization_name": "Organization Name",
        "organization": { ... },
        "name": "NEWFIELD",
}
  • data_type:合法値: UTF8 / BOOL / DECIMAL / INT / FORMULA / DATE

  • name:欄位名稱

  • formula:公式內容

無法刪除,是否顯示靠 is_active 來決定。

Create

/api/v0.1/workflow_field/create/

建立時預設會讓流程內全部的節點看到(visible_fields)。如果要更改設定,請利用 workflow_node/update API。

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/workflow_field/create/ \
  -H 'content-type: application/json' \
  -d '{
  "apikey": "test_key",
  "workflow": {"__id__": 24 },
  "field":{
    "name":"NEWFIELD",
    "data_type": "UTF8"
  }
}'

Response:

{
    "RESPONSE": "OK",
    "field": {
        "organization_id": 10,
        "data_type": "UTF8",
        "is_active": true,
        "__id__": 55,
        "organization_name": "Organization Name",
        "organization": { ... },
        "name": "NEWFIELD"
    }
}

Batch

/api/v0.1/workflow_field/batch/

一次建立多個欄位。

fields 欲建立的欄位列表。

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/workflow_field/batch/ \
  -H 'content-type: application/json' \
  -d '{
  "apikey": "761533a4119c437cf5531d9de6a1f7c6008512871a0c4339eda7caa246ab28a3",
  "workflow": {"__id__": 1 },
  "fields":[
    {
      "name":"Gender",
      "data_type": "UTF8"
    },
    {
      "name":"Age",
      "data_type": "UTF8"
    },
    {
      "name":"Address",
      "data_type": "UTF8"
    }
  ]
}'

Response:

{
    "RESPONSE": "OK",
    "fields": [
        {
            "is_complete": false,
            "name": "Gender",
            "is_active": true,
            "organization_id": 1,
            "data_type": "UTF8",
            "__id__": 10,
            "organization": { ... }
        },
        {
            "is_complete": false,
            "name": "Age",
            "is_active": true,
            "organization_id": 1,
            "data_type": "UTF8",
            "__id__": 11,
            "organization": { ... }
        },
        {
            "is_complete": false,
            "name": "Address",
            "is_active": true,
            "organization_id": 1,
            "data_type": "UTF8",
            "__id__": 12,
            "organization": { ... }
        }
    ]
}

List

/api/v0.1/workflow_field/list/

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/workflow_field/list/ \
  -H 'content-type: application/json' \
  -d '{
    "apikey": "test_key",
    "workflow": { "__id__": 24 }
}'

Response:

{
    "RESPONSE": "OK",
    "fields": [
        {
            "organization_id": 10,
            "data_type": "UTF8",
            "is_active": true,
            "__id__": 55,
            "organization_name": "Organization Name",
            "organization": { ... },
            "name": "NEWFIELD",
            "workflow_visible": true
        },
        {
            "organization_id": 10,
            "data_type": "UTF8",
            "is_active": true,
            "__id__": 54,
            "organization_name": "Organization Name",
            "organization": { ... },
            "name": "Another field",
            "workflow_visible": false
        }
    ]
}

Activate

/api/v0.1/workflow_field/activate/

workflow:Workflow object. 針對該流程加入欄位。

fields:Array of field object. 欲加入的欄位。

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/workflow_field/activate/ \
  -H 'content-type: application/json' \
  -d '{
    "apikey":"test_key",
    "workflow": {"__id__": 32},
    "fields":[{"__id__": 65}]
}'

Response:

{
    "RESPONSE": "OK"
}

Inactivate

/api/v0.1/workflow_field/inactivate/

workflow:Workflow object. 針對該流程刪除欄位。

fields:Array of field object. 欲刪除的欄位。

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/workflow_field/inactivate/ \
  -H 'content-type: application/json' \
  -d '{
    "apikey":"test_key",
    "workflow":{"__id__": 32},
    "fields":[{"__id__": 65}]
}'

Response:

{
    "RESPONSE": "OK"
}

Update

/api/v0.1/workflow_field/update/

workflow:流程

field 可更新欄位:

  • name:欄位名稱

  • formula:當 field type 為 FORMULA 型態時才可傳,內容是公式

  • visible_nodes:可視欄位

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/workflow_field/update/ \
  -H 'content-type: application/json' \
  -d '{
    "apikey":"test_key",
    "workflow":{"__id__": 13},
    "field":{"__id__": 55, "name": "UPDATED_FIELDNAME"}
}'

Response:

{
    "RESPONSE": "OK",
    "field": {
        "organization_id": 10,
        "data_type": "UTF8",
        "is_active": true,
        "__id__": 55,
        "organization_name": "Organization Name",
        "organization": { ... },
        "name": "UPDATED_FIELDNAME",
    }
}

Document

Document object 中重要欄位如下:

  • creator:User object,文件發起人。

  • creation_time:Date object,文件建立時間。

  • last_time:Date object,文件最後修改時間。

  • completion_time:Date object,文件完成時間。

  • current_nodes:Array of node object,目前進行的節點。

  • completed_nodes:Array of node object,已完成的節點。

  • current_users:Array of user object,目前進行節點的負責人。

  • current_responsible_users:Array of user object,目前進行節點的負責人加上被 CC 要回應的人員。

  • signed_users:Array of user object,簽過名的使用者。

  • workflow:流程。

  • signatures:Array of signature object。

  • comments:Array of comment。

  • filled_fields:Array of field object,所有填過的欄位。

  • cc_list:Array of cc object。

  • latest_version:整數,文件的最新版本號。

  • is_cancelled:是否被取消。

  • is_hidden:是否被隱藏。

  • is_revoked:是否被撤回。

  • is_complete:是否完成。

  • title:String,文件標題。

Signature

{
    "user_id": 2,
    "creation_time": {
          "__type__": "datetime",
          "__value__": "2017-08-14T12:23:30.013970+08:00"
    },
    "document_id": 48,
    "is_invalidated": false,
    "__id__": 50,
    "version": 1,
    "type": "NEXT"
}

效能考量,注意 Signature 內沒有再展開物件,只用 id 來記錄。

重要欄位:

  • user_id:簽名 User 的 ID。

  • creation_time:簽名時間。

  • document_id:文件 ID。

  • version:簽在哪個版本上。

  • type:值為 NEXT | REJ | CC

  • is_invalidated:Boolean,是否被退回。

  • fulfilled_fields_ids:Array of ID,簽了哪些欄位。

  • fulfilled_nodes_ids:Array of ID,滿足哪些節點。

  • completed_nodes_ids:Array of ID,完成哪些節點。

CC

{
    "from_user_id": 2,
    "to_user_id": 1,
    "sender_comment_version": 2,
    "is_complete": false,
    "__id__": 1,
    "doc_id": 26,
    "parent_cc": null,
    "receiver_comment_version": -1
}

效能考量,注意 CC 內沒有再展開物件,只用 id 來記錄。

重要欄位:

  • from_user_id:CC 發起使用者 ID。

  • to_user_id:被 CC 的使用者 ID。

  • sender_comment_version:CC 發起時文件的版本號。

  • receiver_comment_version:回覆 CC 時文件的版本號,-1 為尚未回覆。

Comment: Comment 物件並無 ID,是由 document 的資料 derive 出來的。

{
    "reject_to_user_id": null,
    "comment": "Hello",
    "user_id": 2,
    "user": "yllan",
    "is_cc_reply": false,
    "sender_cc_id": 1,
    "receiver_cc_id": null,
    "reject_to_version": null,
    "is_rejection": false,
    "datetime": {
      "__type__": "datetime",
      "__value__": "2017-08-09T12:30:47.403961+08:00"
    }
}

重要欄位:

  • comment:字串,comment 內容。

  • datetime:建立時間。

  • is_rejection:Boolean,此 comment 是否為退回文件。

  • reject_to_user_id:若 is_rejectiontrue,則此欄位為退回到的 user id,否則為 null

  • reject_to_version:若 is_rejectiontrue,則此欄位為退回到的文件版本,否則為 null

  • is_cc_reply:Boolean,是否為回覆 CC。

  • sender_cc_id:CC Object ID,發送者的 CC。

  • receiver_cc_id:CC Object ID,接收者的 CC。

Create

/api/v0.1/document/create/

必填:

workflow:流程

creator:流程發起人,User object

document:文件內容,包括

  • title:文件標題

delegated_user:Optional,若 creator=A, delegated_user=B,代表由 B 代理 A,以 A 的身份建立文件。

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/document/create/ \
  -H 'content-type: application/json' \
  -d '{
  "apikey": "761533a4119c437cf5531d9de6a1f7c6008512871a0c4339eda7caa246ab28a3",
  "workflow": {"__id__": 2 },
  "creator": {"__id__": 2},
  "document": {"title": "GREAT DOC"}
}'

Response: 參考 Document Get 的格式。

List

/api/v0.1/document/list/

current_user:使用者

以下條件必須至少一個。各個條件是聯集(OR)運算。

current_document:Boolean,TODO 裡的文件

signed_document:Boolean,current_user 簽過的文件。

archived_document:Boolean,封存的文件。

created_document:Boolean,current_user 所建立的文件。

all_document:Boolean,可讀取的所有文件。

以下條件為 optional,會是交集(AND)運算。

creator:User object,該作者所建立的文件。

created_after:建立時間晚於(包含)此時的文件。

created_before:建立時間早於(包含)此時的文件。

時間的格式如下:

{
  "__value__":"2017-08-01T12:20:57.560650+08:00",
  "__type__":"datetime"
}

結果會根據文件狀態分成四個 array,分別是:

  • processing 未完成文件。

  • completed 已完成文件。

  • revoked 已撤回文件。

  • cancelled 已取消文件。

內容為簡化後的 object:

  • creator_id:建立者的 ID

  • creator_username:建立者的 username

  • creator_display_name:建立者的顯示名稱

  • latest_version:文件最新的版本號

  • last_time:文件最後更動時間

  • creation_time:文件建立時間

  • title:文件標題

  • workflow_name:流程名稱

  • workflow_id:流程 ID

  • id:文件 ID

      {
        "workflow_id": 2,
        "creation_time": {
          "__type__": "datetime",
          "__value__": "2017-08-14T12:20:57.560650+08:00"
        },
        "creator_display_name": "yllan",
        "title": "Omni!",
        "__id__": 48,
        "workflow_name": "FLOW_FROM_API",
        "creator_id": 2,
        "latest_version": 5,
        "creator_username": "yllan@HYPO",
        "last_time": {
          "__type__": "datetime",
          "__value__": "2017-08-14T15:43:59.356933+08:00"
        }
      }

Request:

curl -X "POST" \
     https://demo.omnibpm.com/api/v0.1/document/list/ \
     -H "Content-Type: application/json" \
     -d '{
  "current_document": true,
  "current_user": {"__id__": 2},
  "apikey": "761533a4119c437cf5531d9de6a1f7c6008512871a0c4339eda7caa246ab28a3"
}'

Response:

{
  "RESPONSE": "OK",
  "processing": [
    { ... },
    { ... },
    { ... }
  ],
  "revoked": [],
  "cancelled": [],
  "completed": []
}

Submit

/api/v0.1/document/submit/

必填:

document: Document object,裡面必須包含

  • latest_version:若 latest_version 並非最新版,代表有其他人已經簽過,手上的資料是過時的,要抓取新的 document 資料。此時會回覆 {"RMSG": "Outdated Document Version:Outdated document.", "RESPONSE": "Outdated Document Version"},請用 document/get 抓取更新資料後再重送。

  • field_content:表單內容,是一個 Dictionary,key 為 field_id,value 按照 field data_type 有不同格式:

    • INT123

    • UTF8"Free text"

    • DECIMAL{"type": "decimal", "value": 3.14}

    • DATE{"type": "datetime", "value": "2017-12-13T00:00:0.000+08:00"}

    • BOOLtrue / false

user:簽這份文件的身份,必須是目前正在進行的任一節點的負責人才行。否則會發生錯誤。

comment:簽署文件下的註解。

選填: delegated_user:Optional,若 user=A, delegated_user=B,代表由 B 代理 A,以 A 的身份簽核文件。

回傳:

  • version:簽完產生的版本

  • document:只有 id

  • is_completed:文件是否完成

Request:

curl -X "POST" "https://demo.omnibpm.com/api/v0.1/document/submit/" \
     -H "Content-Type: application/json" \
     -d '{
  "document": {
    "field_content": {
      "1": "Bill",
      "2": "0987654321",
      "3": "Very Good",
      "4": "I love you"
    },
    "latest_version": 1,
    "__id__": 48
  },
  "comment": "First step",
  "apikey": "761533a4119c437cf5531d9de6a1f7c6008512871a0c4339eda7caa246ab28a3",
  "user": {"__id__": 2}
}'

Response:

{
  "version": 2,
  "document": {
    "__id__": 48
  },
  "is_complete": false,
  "RESPONSE": "OK"
}

Reject

/api/v0.1/document/reject/

必填:

document:目前文件

user:發動退回的使用者

signature:Signature object,要退回到的簽名

comment:退回文件的註解

選填: delegated_user:Optional,若 creator=A, delegated_user=B,代表由 B 代理 A,以 A 的身份退回文件。

Request:

curl -X "POST" "https://demo.omnibpm.com/api/v0.1/document/reject/" \
     -H "Content-Type: application/json" \
     -d '{
  "document": {
    "latest_version": 3,
    "__id__": 48
  },
  "signature": {
    "__id__": "52"
  },
  "comment": "I don't allow this to happen!",
  "apikey": "761533a4119c437cf5531d9de6a1f7c6008512871a0c4339eda7caa246ab28a3",
  "user": {
    "__id__": 2
  }
}'

Response:

{
  "RESPONSE": "OK"
}

Revoke

/api/v0.1/document/revoke/ 已完成的文件,可以被撤回。若狀態非已完成,會產生錯誤。

參數:

document:Document object.

user:User object.

delegated_user:Optional,若 creator=A, delegated_user=B,代表由 B 代理 A,以 A 的身份撤回文件。

Request:

## document/revoke/
curl -X "POST" "https://demo.omnibpm.com/api/v0.1/document/revoke/" \
     -H 'Content-Type: application/json' \
     -d $'{
  "document": {
    "__id__": 13
  },
  "user": {
    "__id__": 2
  },
  "apikey": "761533a4119c437cf5531d9de6a1f7c6008512871a0c4339eda7caa246ab28a3"
}'

Response:

{
  "RESPONSE": "OK"
}

Cancel

/api/v0.1/document/cancel/ 在文件還沒完成以前,發起人可以取消文件。

參數:

document:Document object.

user:User object.

delegated_user:Optional,若 creator=A, delegated_user=B,代表由 B 代理 A,以 A 的身份取消文件。

Request:

## document/cancel/
curl -X "POST" "https://demo.omnibpm.com/api/v0.1/document/cancel/" \
     -H 'Content-Type: application/json' \
     -d $'{
  "document": {
    "__id__": 47
  },
  "user": {
    "__id__": 2
  },
  "apikey": "761533a4119c437cf5531d9de6a1f7c6008512871a0c4339eda7caa246ab28a3"
}'

Response:

{
  "RESPONSE": "OK"
}

Get

/api/v0.1/document/get/

必填:

document:Document object

user:User object,API 會標記該 user 已讀此文件

version:版本,不傳預設為 0(最新版)。

Request:

curl -X POST \
  https://demo.omnibpm.com/api/v0.1/document/get/ \
  -H 'content-type: application/json' \
  -d '{
  "apikey": "test_key",
  "user": {"__id__": 16},
  "document": {"__id__": 26}
}'

回傳: 在 document object 內,還有以下欄位:

unused_fields:Array of Workflow field object

hidden_fields:Array of Workflow field object

required_fields:Array of Workflow field object

document_fields:Array of Workflow field object

field_content:Map from field id to content cc_list:Array of CC object

logs:Array of log object

signatures:Array of Signature object

comments:Array of Comment object

current_nodes:Array of Workflow node object

completed_nodes:Array of Workflow node object

required_job_assignments:Array of Workflow node object

nodes:Array of Workflow node object

current_users:Array of User object

signed_users:Array of User object

供 UI 判斷顯示按鈕用:

is_rejectable:Boolean,是否顯示 reject 按鈕

is_submittable:Boolean,是否顯示 submit 按鈕

is_cancellable:Boolean,是否顯示 cancel 按鈕

allow_cc_for_user:Boolean,是否顯示 CC 按鈕

is_cc_responsible:Boolean,是否顯示 reply 按鈕

is_cc_reply_readable:Boolean,是否顯示 read 按鈕

Response:

{
  "RESPONSE": "OK",
  "document": {
    "cc_list": [],
    "nodes": [
      { ... },
      { ... },
      { ... }
    ],
    "is_hidden": false,
    "filled_fields_ids": [105, 106],
    "is_revivable": false,
    "organization_id": 1,
    "is_poked": false,
    "last_time": {
      "__type__": "datetime",
      "__value__": "2017-12-10T21:43:20.838290+08:00"
    },
    "current_users_ids": [15, 1, 20, 7, 8, 11, 12],
    "is_cc_reply_readable": false,
    "is_cc_responsible": false,
    "completed_nodes": [
      { ... }
    ],
    "upcomming_tasks": [
      { ... },
      { ... }
    ],
    "is_read": true,
    "hidden_fields": [],
    "is_classified": false,
    "web_layout": "{\"order\":[\"field_105\",\"field_106\",\"field_107\"],\"description\":\"\",\"field_105\":{\"id\":105,\"type\":\"UTF8\",\"text\":\"F1\",\"col\":1,\"row\":1,\"proportion\":0},\"field_106\":{\"id\":106,\"type\":\"UTF8\",\"text\":\"F2\",\"col\":1,\"row\":1,\"proportion\":0},\"field_107\":{\"id\":107,\"type\":\"UTF8\",\"text\":\"F3\",\"col\":1,\"row\":1,\"proportion\":0}}",
    "is_ccable": false,
    "field_content": {
      "106": "yyy",
      "105": "xxx",
      "TITLE": "fff"
    },
    "visible_department_heads_ids": [1, 5],
    "deadline": null,
    "is_rejectable": true,
    "is_cancelled": false,
    "version": 0,
    "completion_time": null,
    "current_nodes": [
      { ... }
    ],
    "formula_recalc_fields": [],
    "priority_name": "Normal",
    "creator_username": "yllan@HYPO",
    "fill_by_current_user": false,
    "current_nodes_ids": [208],
    "title_formula": null,
    "visible_users_ids": [2],
    "allow_cc_for_user": true,
    "creation_time": {
      "__type__": "datetime",
      "__value__": "2017-12-10T21:41:45.377481+08:00"
    },
    "is_revoked": false,
    "comments": [],
    "is_revokable": false,
    "signed_users_ids": [2],
    "creator_id": 2,
    "title": "fff",
    "completed_nodes_ids": [205],
    "signatures": [
      { ... }
    ],
    "disable_file_upload": false,
    "is_completed": false,
    "__id__": 72,
    "organization_name": "Hypo",
    "unused_fields": [],
    "attachedfiles": [],
    "creator": { ... },
    "is_visible": true,
    "current_responsible_users": [
      { ... },
      { ... },
      { ... },
      { ... }
    ],
    "serial": "Process-20171210-00001",
    "required_fields": [
      { ... },
      { ... }
    ],
    "__model__": "Document",
    "document_fields": [
      { ... },
      { ... },
      { ... }
    ],
    "current_users": [
      { ... },
      { ... },
      { ... },
      { ... },
      { ... }
    ],
    "is_creator": true,
    "signed_users": [
      { ... }
    ],
    "required_job_assignments": [],
    "is_submittable": false,
    "latest_version": 1,
    "related_documents_ids": [],
    "is_cancellable": true,
    "all_signatures": [
      { ... }
    ],
    "responsible_nodes": [
      { ... }
    ],
    "creator_name": "yllan",
    "workflow": { ... },
    "is_created": true,
  }
}

CC

/api/v0.1/document/cc/

轉匯文件。

參數:

document:Document object,進行中的文件。

from_user:User object,誰發起轉匯。

to_user:User object,轉匯給誰。

reply_required:Boolean,是否需要回覆。

comment:String,轉匯的訊息。

node:Node object,從哪個節點發起轉匯。

Request:

## document/cc/
curl -X "POST" "https://demo.omnibpm.com/api/v0.1/document/cc/" \
     -H "Content-Type: application/json" \
     -d '{
  "apikey": "761533a4119c437cf5531d9de6a1f7c6008512871a0c4339eda7caa246ab28a3",
  "document": {
    "__id__": 26
  },
  "from_user": {
    "__id__": 2
  },
  "reply_required": false,
  "to_user": {
    "__id__": "1"
  },
  "comment": "Hello",
  "node": {
    "__id__": 46
  }
}'

Response:

{
  "RESPONSE": "OK",
  "document": {
    "last_time": {
      "__type__": "datetime",
      "__value__": "2017-08-14T11:28:17.443226+08:00"
    },
    "is_revoked": false,
    "latest_version": 4,
    "creation_time": {
      "__type__": "datetime",
      "__value__": "2017-08-09T12:09:11.923197+08:00"
    },
    "comments": [
      {
        "reject_to_user_id": null,
        "comment": "Hello",
        "login_user": { ... },
        "user_id": 2,
        "user": "yllan",
        "is_cc_reply": false,
        "sender_cc_id": 1,
        "receiver_cc_id": null,
        "reject_to_version": null,
        "is_rejection": false,
        "datetime": {
          "__type__": "datetime",
          "__value__": "2017-08-09T12:30:47.403961+08:00"
        }
      },
      {
        "reject_to_user_id": null,
        "comment": "Hello",
        "login_user": { ... },
        "user_id": 2,
        "user": "yllan",
        "is_cc_reply": false,
        "sender_cc_id": 2,
        "receiver_cc_id": null,
        "reject_to_version": null,
        "is_rejection": false,
        "datetime": {
          "__type__": "datetime",
          "__value__": "2017-08-09T12:33:14.411610+08:00"
        }
      },
      {
        "reject_to_user_id": null,
        "comment": "Hello",
        "login_user": { ... },
        "user_id": 2,
        "user": "yllan",
        "is_cc_reply": false,
        "sender_cc_id": 3,
        "receiver_cc_id": null,
        "reject_to_version": null,
        "is_rejection": false,
        "datetime": {
          "__type__": "datetime",
          "__value__": "2017-08-14T11:28:17.131581+08:00"
        }
      }
    ],
    "signed_users": [],
    "visible_users_ids": [ 1, 2 ],
    "visible_users": [
      { ... },
      { ... }
    ],
    "is_completed": false,
    "current_users_ids": [ 8 ],
    "organization_id": 1,
    "related_documents_ids": [],
    "creator_id": 2,
    "current_nodes_ids": [
      41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52
    ],
    "is_created": true,
    "completion_time": null,
    "completed_nodes": [],
    "visible_department_heads_ids": [
      1,
      5
    ],
    "current_nodes": [
      { ... },
      { ... },
      { ... },
      { ... },
      { ... },
      { ... },
      { ... },
      { ... },
      { ... },
      { ... },
      { ... },
      { ... }
    ],
    "organization_name": "Hypo",
    "creator": { ... },
    "current_users": [
      { ... }
    ],
    "priority_id": 1,
    "__model__": "Document",
    "organization": { ... },
    "subscribed_users": [],
    "completed_nodes_ids": [],
    "is_cancelled": false,
    "creator_username": "yllan@HYPO",
    "signatures": [],
    "visible_department_heads": [
      { ... },
      { ... }
    ],
    "title": "HAHAHA",
    "subscribed_users_ids": [],
    "is_hidden": false,
    "creator_name": "yllan",
    "workflow": { ... },
    "__id__": 26,
    "is_classified": false,
    "serial": null,
    "filled_fields": [],
    "cc_list": [
      {
        "__model__": "CC",
        "sender_comment_version": 2,
        "is_complete": false,
        "from_user_username": "yllan@HYPO",
        "__id__": 1,
        "doc_id": 26,
        "to_user_id": 1,
        "to_user_username": "admin@HYPO",
        "to_user_name": "admin",
        "parent_cc": null,
        "organization_id": 1,
        "organization_name": "Hypo",
        "from_user_name": "yllan",
        "from_user_id": 2,
        "receiver_comment_version": -1
      },
      {
        "__model__": "CC",
        "sender_comment_version": 3,
        "is_complete": false,
        "from_user_username": "yllan@HYPO",
        "__id__": 2,
        "doc_id": 26,
        "to_user_id": 1,
        "to_user_username": "admin@HYPO",
        "to_user_name": "admin",
        "parent_cc": null,
        "organization_id": 1,
        "organization_name": "Hypo",
        "from_user_name": "yllan",
        "from_user_id": 2,
        "receiver_comment_version": -1
      },
      {
        "__model__": "CC",
        "sender_comment_version": 4,
        "is_complete": false,
        "from_user_username": "yllan@HYPO",
        "__id__": 3,
        "doc_id": 26,
        "to_user_id": 1,
        "to_user_username": "admin@HYPO",
        "to_user_name": "admin",
        "parent_cc": null,
        "organization_id": 1,
        "organization_name": "Hypo",
        "from_user_name": "yllan",
        "from_user_id": 2,
        "receiver_comment_version": -1
      }
    ],
    "current_responsible_users": [
      { ... },
      { ... }
    ],
    "related_documents": [],
    "signed_users_ids": [],
    "filled_fields_ids": [],
    "deadline": null
  }
}

CC List Target

/api/v0.1/document/cc/list_target/

根據傳入 document 以及 user,列出該 user 所在節點之可轉匯人員名單(若該 user 同時在多個節點上,回傳名單聯集)。回傳 users 為可轉匯人員 Array of user object。

document:Document object。

user:User object。

Request:

curl -X "POST" "https://demo.omnibpm.com/api/v0.1/document/cc/list_target/" \
     -H "Content-Type: application/json" \
     -d '{
  "document": {
    "__id__": 26
  },
  "user": {
    "__id__": 4
  },
  "apikey": "761533a4119c437cf5531d9de6a1f7c6008512871a0c4339eda7caa246ab28a3"
}'

Response:

{
  "users": [
    {
      "rank": { ... },
      "organization": { ... },
      "department": { ... },
      "display_name": "admin",
      "email": "",
      "username": "admin@HYPO",
      "is_active": true,
      "department_name": "MIS Department",
      "rank_name": "Manager",
      "is_external": false,
      "__id__": 1
    },
    {
      "rank": { ... },
      "organization": { ... },
      "department": { ... },
      "display_name": "yllan",
      "email": "yllan@hypo.cc",
      "username": "yllan@HYPO",
      "is_active": true,
      "department_name": "Sales Department",
      "rank_name": "Director",
      "is_external": false,
      "__id__": 2
    }
  ],
  "RESPONSE": "OK"
}

CC Reply

/api/v0.1/document/cc/reply/ 回覆 CC

必填參數:

document:Document object.

user:User object.

cc:CC object.

comment:String.

Request:

## document/cc/reply/
curl -X "POST" "https://demo.omnibpm.com/api/v0.1/document/cc/reply/" \
     -H 'Content-Type: application/json' \
     -d $'{
  "document": {
    "__id__": 26
  },
  "cc": {
    "__id__": 8
  },
  "comment": "World.",
  "apikey": "761533a4119c437cf5531d9de6a1f7c6008512871a0c4339eda7caa246ab28a3",
  "user": {
    "__id__": "1"
  }
}'

Response:

{
  "RESPONSE": "OK",
  "cc": {
    "doc": { ... },
    "__id__": 8,
    "parent_cc": null,
    "sender_comment_version": 7,
    "from_user": { ... },
    "organization_id": 1,
    "to_user": { ... },
    "doc_id": 26,
    "organization": { ... },
    "receiver_comment_version": 8,
    "is_complete": true,
    "__model__": "CC"
  }
}

Assign Agent

/api/v0.1/document/assign_agent/

當遇到「待指定負責人」的節點時,需要指定該節點的負責人即為此 API。對一個節點可指定複數的人員。

必填:

document:文件

user:目前簽署者的身份

node:欲指定負責人的節點

agents:List of users. 該節點的負責人

Request:

curl -X "POST" "https://demo.omnibpm.com/api/v0.1/document/assign_agent/" \
     -H "Content-Type: application/json" \
     -d '{
  "document": {"__id__": 45},
  "node": {"__id__": 34},
  "apikey": "761533a4119c437cf5531d9de6a1f7c6008512871a0c4339eda7caa246ab28a3",
  "agents": [
    {"__id__": 1}
  ],
  "user": {"__id__": 2}
}'

Response:

{
  "RESPONSE": "OK"
}

Log

/api/v0.1/document/log

顯示文件的編輯紀錄。

Document Log 格式如下:

{
    "user": {...},
    "delegated_user": {...},
    "creation_time":{
      "__value__":"2017-12-18T15:18:41.290731+08:00",
      "__type__":"datetime"
    },
    "action":"create",
    "type":"new_document"
}

若 user=A, delegated_user=B,代表實際上由 B 代理 A,以 A 的身份做動作。 若無代理則 user == delegated_user。

其中 action / type 決定了此筆 log 的類型。Restful API 能產生的類型如下:

  • action = create, type = new_document: 建立 document。額外欄位: document{"id": doc_id}

  • action = sign, type = sign: 簽核。額外欄位: signature:Signature object. comment:string。

  • action= reject, type = reject: 退回。額外欄位: reject:Signature object. comment:string。

  • action = change, type = designate: 指定負責人。額外欄位: node:Workflow Node Object。被指定的節點 users:Array of User Object。被指定的使用者。

  • action = cc, type = to_user 發起 CC。額外欄位: cc:CC Object。 comment:string。

  • action = cc_reply, type = cc_read 已讀 / 回覆 CC。額外欄位: cc:CC Object。 comment:string。

(web 介面可能產生更多類型,例如上傳檔案、tag、priority 等,在此就沒列出)

Request:

## document/log/
curl -X "POST" "https://demo.omnibpm.com/api/v0.1/document/log/" \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{
  "document": {
    "__id__": 86
  },
  "apikey": "761533a4119c437cf5531d9de6a1f7c6008512871a0c4339eda7caa246ab28a3"
}'

Response:

{
  "RESPONSE": "OK",
  "logs": [
    {
      "creation_time": {
        "__value__": "2017-12-18T15:18:41.290731+08:00",
        "__type__": "datetime"
      },
      "action": "create",
      "user": {
        "__model__": "UserProfile",
        "__id__": 2
      },
      "document": {
        "__id__": 86
      },
      "type": "new_document"
    },
    {
      "action": "sign",
      "user": {
        "__model__": "UserProfile",
        "__id__": 2
      },
      "comment": "yllan's sign",
      "signature": {
        "login_user_name": "yllan",
        "__model__": "Signature",
        "creation_time": {
          "__value__": "2017-12-18T15:28:31.580108+08:00",
          "__type__": "datetime"
        },
        "login_user_username": "yllan@HYPO",
        "completed_nodes_ids": [
          210
        ],
        "autocompleted_for_others_nodes_ids": [],
        "document_id": 86,
        "organization_id": 1,
        "rejection_target": null,
        "version": 2,
        "is_invalidated": true,
        "login_user_id": 2,
        "__id__": 131,
        "user_name": "yllan",
        "user_username": "yllan@HYPO",
        "user_id": 2,
        "fulfilled_nodes_ids": [
          210,
          211
        ],
        "signed_as_id": 1,
        "type": "NEXT",
        "organization_name": "Hypo",
        "autocompleted_nodes_ids": [],
        "fulfilled_fields_ids": [
          108,
          109,
          110,
          111,
          112,
          113
        ],
        "processing_time": 0
      },
      "type": "sign",
      "creation_time": {
        "__value__": "2017-12-18T15:28:31.583767+08:00",
        "__type__": "datetime"
      }
    },
    {
      "action": "reject",
      "user": {
        "__model__": "UserProfile",
        "__id__": 2
      },
      "comment": "I don't agree this!",
      "type": "reject",
      "reject": {
        "login_user_name": "yllan",
        "__model__": "Signature",
        "creation_time": {
          "__value__": "2017-12-18T15:31:00.528649+08:00",
          "__type__": "datetime"
        },
        "login_user_username": "yllan@HYPO",
        "completed_nodes_ids": [],
        "autocompleted_for_others_nodes_ids": [],
        "document_id": 86,
        "organization_id": 1,
        "version": 3,
        "is_invalidated": false,
        "rejection_target_id": 131,
        "login_user_id": 2,
        "__id__": 132,
        "user_name": "yllan",
        "user_username": "yllan@HYPO",
        "user_id": 2,
        "fulfilled_nodes_ids": [],
        "signed_as_id": 1,
        "type": "REJ",
        "organization_name": "Hypo",
        "autocompleted_nodes_ids": [],
        "fulfilled_fields_ids": [],
        "processing_time": 0
      },
      "creation_time": {
        "__value__": "2017-12-18T15:31:00.529615+08:00",
        "__type__": "datetime"
      }
    },
    {
      "action": "change",
      "user": {
        "__model__": "UserProfile",
        "__id__": 2
      },
      "node": { ... },
      "type": "designate",
      "users": [
        {
          "__model__": "UserProfile",
          "__id__": 1
        },
        {
          "__model__": "UserProfile",
          "__id__": 9
        }
      ],
      "creation_time": {
        "__value__": "2017-12-18T15:54:30.795323+08:00",
        "__type__": "datetime"
      }
    }
  ]
}
聯繫我們
Check our apps
More to known
Ⓒ 2018 Omniscient Cloud Technology Inc.
關於我們
媒體報導