OmniBPM restful API

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

基本上所有的物件都有三個 field,__id____model____client_extra____id__ 是 PK,除了在創建以外必填。 __model__ 只是用來儲存物件型態的欄位,optional 可省略。填了的話系統會 check,如果形態不一致會報錯。 __client_extra__ 可用來存任意的 JSON object 資訊,也是 optional。

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

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

如果正確,一定會有

{"RESPONSE": "OK"}

Organization


List

/api/mds/organization/list/

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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/mds/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/mds/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/mds/organization/inactivate/ ****

__id__ 必填,OmniBPM 裡的 Organization PK

Request:

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

Response:

{
  "RESPONSE": "OK"
}

Activate

/api/mds/organization/activate/ ****

__id__ 必填,OmniBPM 裡的 Organization PK

Request:

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

Response:

{
  "RESPONSE": "OK"
}

Get

/api/mds/organization/get/ ****

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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/mds/organization/update/

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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/mds/organization/delete/

傳入的 api_key 為 master api key。

Request:

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

Response:

{
  "RESPONSE": "OK"
}

Import Users

/api/mds/organization/importusers/ ****

display_name 必填,顯示用名稱 username 必填,登入用帳號 email 必填 is_external 必填,是否為外部使用者(否) is_active 必填,是否啟用 department 必填,部門 rank 必填,職等

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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"
}

- __id__ OmniBPM 用的 PK

List

/api/mds/department/list/

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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/mds/department/create/

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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/mds/department/inactivate/

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

Request:

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

Response:

{
  "RESPONSE": "OK"
}

Activate

/api/mds/department/activate/

Request:

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

Response:

{
  "RESPONSE": "OK"
}

Update

/api/mds/department/update/

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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/mds/department/delete/

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

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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"
}

- name 職等名稱

List

/api/mds/rank/list/

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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/mds/rank/create/

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

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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/mds/rank/inactivate/

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

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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/mds/rank/activate/

Request:

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

Response:

{
  "RESPONSE": "OK"
}

Update

/api/mds/rank/update/

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

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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/mds/rank/delete/

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

Request:

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

Response:

{
  "RESPONSE": "OK"
}

Order

/api/mds/rank/order/

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

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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_* 是和微軟登入相關的)用不到可先忽略。主要用到的欄位有:

- department 部門

List

/api/mds/user/list/

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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/mds/user/create/

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

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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/mds/user/inactivate/

Request:

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

Response:

{"RESPONSE": "OK"}

Activate

/api/mds/user/activate/

Request:

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

Response:

{"RESPONSE": "OK"}

Update

/api/mds/user/update/ 能修改的欄位只有

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/mds/user/delete/

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

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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/mds/group/user/list//api/mds/group/user/add//api/mds/group/user/remove/


List

/api/mds/group/list/

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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/mds/group/create/

name 同一個組織下的 name 必須是唯一值,不可重複。不同組織則可重複。 users 欲加入此群組的人員列表,optional。

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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/mds/group/inactivate/

Request:

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

Response:

{"RESPONSE": "OK"}

Activate

/api/mds/group/activate/

Request:

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

Response:

{"RESPONSE": "OK"}

Update

/api/mds/group/update/

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

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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/mds/group/delete/

刪除群組。

Request:

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

Response:

{
    "RESPONSE": "OK"
}

User List

/api/mds/group/user/list/

列出群組的成員。

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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/mds/group/user/add/

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

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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/mds/group/user/remove/

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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/mds/workflow/create/

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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/mds/workflow/clone/

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

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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/mds/workflow/save_as/

將目前流程另存成一個新的名字的流程。 workflow: Workflow object, 被另存的流程。 new_name: String, 新流程的名字。

Request:

curl -X "POST" "https://demo.omnibpm.com/api/mds/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/mds/workflow/list/

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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/mds/workflow/update/

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

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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/mds/workflow/finalize/

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

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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/mds/workflow/activate/

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

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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/mds/workflow/inactivate/

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

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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/mds/workflow/hide/

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

Request:

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

Response:

{
  "RESPONSE": "OK"
}

Workflow Node

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

必填欄位: n_sign: 此節點要被多少人簽過才算完成 note: 節點名稱

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

除了「待指定負責人」的節點以外,其他種類節點的 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/mds/workflow_node/create/

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

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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"
}
  1. 產生文件發起人節點:

Request:

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

Request

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

Request

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

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/workflow_node/create/ \
  -H 'content-type: application/json' \
  -d '{
  "apikey": "3f709f63643853c7d772d412de5597dd891dc83f7263d9e8690d8c47d739d969",
  "workflow": {"__id__": 2 }, 
  "node":{
    "note": "群組節點",
    "group": {"__id__": 30},
    "n_sign": 1
  }
}'
  1. 主管簽核節點(流程發起人的主管)

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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/mds/workflow_node/list/

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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/mds/workflow_node/delete/

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

Request:

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

Response:

{
    "RESPONSE": "OK"
}

Update

/api/mds/workflow_node/update/

只能 update

note required_fields visible_fields

若要修改類型,必須砍掉再重建新的。

Request:

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

Response:

{
    "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__": 10414,
        "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/mds/workflow_node/add_child/

建立節點之間的連結。

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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/mds/workflow_node/remove_child/

刪除節點間的連結

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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",
}

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

Create

/api/mds/workflow_field/create/

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

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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/mds/workflow_field/batch/

一次建立多個欄位。

fields 欲建立的欄位列表。

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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/mds/workflow_field/list/

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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"
        },
        {
            "organization_id": 10,
            "data_type": "UTF8",
            "is_active": true,
            "__id__": 54,
            "organization_name": "Organization Name",
            "organization": { ... },
            "name": "Another field"
        }
    ]
}

Activate

/api/mds/workflow_field/activate/

workflow: Workflow object. 針對該流程加入欄位。 fields: Array of field object. 欲加入的欄位。

Request:

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

Response:

{
    "RESPONSE": "OK"
}

Inactivate

/api/mds/workflow_field/inactivate/

workflow: Workflow object. 針對該流程刪除欄位。 fields: Array of field object. 欲刪除的欄位。

Request:

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

Response:

{
    "RESPONSE": "OK"
}

Update

/api/mds/workflow_field/update/

workflow: 流程 field 可更新欄位:

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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,是否被退回。


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,否則為 nullreject_to_version: 若 is_rejectiontrue,則此欄位為退回到的文件版本,否則為 nullis_cc_reply: Boolean,是否為回覆 CC。 sender_cc_id: CC Object ID,發送者的 CC。 receiver_cc_id: CC Object ID,接收者的 CC。


Create

/api/mds/document/create/

必填: workflow: 流程 creator: 流程發起人,User object document: 文件內容,包括

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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/mds/document/list/

current_user: 使用者

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

current_document: Boolean,TODO 裡的文件 signed_document: Boolean,current_user 簽過的文件。 archived_document: Boolean,封存的文件。 creator: User object。該作者所建立的文件

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

內容為簡化後的 object:

Request:

curl -X "POST" \
     https://demo.omnibpm.com/api/mds/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/mds/document/submit/

必填: document: Document object,裡面必須包含

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

~~TODO: 目前填表單還沒有 validate 是否可填欄位,要修正~~

Request:

curl -X "POST" "https://demo.omnibpm.com/api/mds/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
  },
  "RESPONSE": "OK"
}

Reject

/api/mds/document/reject/

必填: document: 目前文件 user: 發動退回的使用者 signature: Signature object,要退回到的簽名

Request:

curl -X "POST" "https://demo.omnibpm.com/api/mds/document/reject/" \
     -H "Content-Type: application/json" \
     -d '{
  "document": {
    "latest_version": 3,
    "__id__": 48
  },
  "signature": {
    "__id__": "52"
  },
  "apikey": "761533a4119c437cf5531d9de6a1f7c6008512871a0c4339eda7caa246ab28a3",
  "user": {
    "__id__": 2
  }
}'

Response:

{
  "RESPONSE": "OK"
}

Revoke

/api/mds/document/revoke/ 參數: document: Document object. user: User object.

Request:


Get

/api/mds/document/get/

必填: document: Document object user: User object,API 會標記該 user 已讀此文件 version: 版本,不傳預設為 0。

Request:

curl -X POST \
  https://demo.omnibpm.com/api/mds/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: Array of CC 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

Response:

{
  "document": {
    "creator_username": "yllan@HYPO",
    "visible_users_ids": [1, 2],
    "filled_fields_ids": [],
    "completed_nodes_ids": [],
    "creator_name": "yllan",
    "is_cancelled": false,
    "signed_users_ids": [],
    "current_nodes": [
      { ... }
    ],
    "is_visible": true,
    "creator_id": 2,
    "is_read": true,
    "is_revoked": false,
    "latest_version": 3,
    "completion_time": null,
    "current_users_ids": [
      2
    ],
    "is_revokable": false,
    "organization_name": "Hypo",
    "organization_id": 1,
    "is_hidden": false,
    "deadline": null,
    "current_users": [
      { ... }
    ],
    "visible_department_heads_ids": [
      1,
      5
    ],
    "priority_name": "Normal",
    "subscribed_users_ids": [],
    "is_cc_responsible": true,
    "current_responsible_users": [
      { ... }
    ],
    "is_completed": false,
    "is_creator": true,
    "last_time": {
      "__value__": "2017-08-15T15:20:13.990100+08:00",
      "__type__": "datetime"
    },
    "priority_id": 1,
    "__id__": 49,
    "archive_until": {
      "__value__": "2017-08-15T15:20:13.996112+08:00",
      "__type__": "datetime"
    },
    "related_documents_ids": [],
    "completed_nodes": [],
    "is_classified": false,
    "__model__": "Document",
    "title": "Omni!",
    "current_nodes_ids": [
      16
    ],
    "cc_list": [
      { ... },
      { ... }
    ],
    "is_revivable": false,
    "creation_time": {
      "__value__": "2017-08-15T13:58:24.343229+08:00",
      "__type__": "datetime"
    },
    "signatures": [],
    "comments": [
      { ... },
      { ... }
    ],
    "is_poked": false,
    "workflow": { ... },
    "is_created": true,
    "is_ccable": false
  },
  "unused_fields": [],
  "upcoming_tasks": [
    { ... },
    { ... },
    { ... },
    { ... },
    { ... },
    { ... },
    { ... },
    { ... },
    { ... },
    { ... },
    { ... },
    { ...}
  ],
  "current_users": [
    { ... }
  ],
  "hidden_fields": [],
  "nodes": [
    { ... },
    { ... },
    { ... },
    { ... },
    { ... },
    { ... },
    { ... },
    { ... },
    { ... },
    { ... },
    { ... },
    { ... }
  ],
  "signatures": [],
  "signed_users": [
    { ... }
  ],
  "version": 3,
  "creator": { ... },
  "formula_recalc_fields": [],
  "completed_nodes": [],
  "current_nodes": [
    { ... }
  ],
  "RESPONSE": "OK",
  "cc": [
    {
      "to_user": {
        ...
      },
      "__model__": "CC",
      "to_user_name": "yllan",
      "from_user_username": "yllan@HYPO",
      "from_user_name": "yllan",
      "to_user_id": 2,
      "is_complete": false,
      "parent_cc": null,
      "organization_name": "Hypo",
      "organization": {
        ...
      },
      "__id__": 4,
      "organization_id": 1,
      "from_user_id": 2,
      "sender_comment_version": -1,
      "to_user_username": "yllan@HYPO",
      "from_user": {
        ...
      },
      "receiver_comment_version": -1,
      "doc_id": 49
    },
    {
      "to_user": {
        ...
      },
      "__model__": "CC",
      "to_user_name": "admin",
      "from_user_username": "yllan@HYPO",
      "from_user_name": "yllan",
      "parent_cc_id": 4,
      "to_user_id": 1,
      "is_complete": true,
      "parent_cc": {
        "is_complete": false,
        "__model__": "CC",
        "to_user_name": "yllan",
        "from_user_username": "yllan@HYPO",
        "from_user_name": "yllan",
        "from_user_id": 2,
        "to_user_id": 2,
        "parent_cc": null,
        "organization_name": "Hypo",
        "organization_id": 1,
        "__id__": 4,
        "doc_id": 49,
        "sender_comment_version": -1,
        "to_user_username": "yllan@HYPO",
        "receiver_comment_version": -1
      },
      "organization_name": "Hypo",
      "organization": { ... },
      "__id__": 5,
      "organization_id": 1,
      "from_user_id": 2,
      "sender_comment_version": 2,
      "to_user_username": "admin@HYPO",
      "from_user": { ... },
      "receiver_comment_version": 3,
      "doc_id": 49
    }
  ],
  "document_fields": [
    {
      "fieldtable": null,
      "__model__": "DocumentField",
      "organization_id": 1,
      "fulfill_by_nodes_ids": [
        19,
        20
      ],
      "name": "Name",
      "organization_name": "Hypo",
      "organization": { ... },
      "data_type": "UTF8",
      "__id__": 1,
      "choicegroup": null,
      "is_active": true,
      "is_complete": true,
      "fulfill_by_nodes": [
        {
          "trigger_workflow_field_content": {},
          "job_assignment_node": null,
          "allow_cc": true,
          "allowed_cc_groups_ids": [],
          "as_doc_creator": true,
          "autocomplete_condition": null,
          "editable_fields": [
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 2,
              "choicegroup": null,
              "is_active": true,
              "is_complete": true,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [
                19
              ],
              "name": "TEL"
            },
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 3,
              "choicegroup": null,
              "is_active": true,
              "is_complete": true,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [
                19
              ],
              "name": "Comment"
            },
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 1,
              "choicegroup": null,
              "is_active": true,
              "is_complete": true,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [
                19,
                20
              ],
              "name": "Name"
            }
          ],
          "note": "Middle",
          "is_complete": false,
          "children_set_ids": [
            18
          ],
          "allowed_cc_departments_ids": [],
          "n_sign": 1,
          "organization_name": "Hypo",
          "organization_id": 1,
          "deadline": 0,
          "visible_fields": [
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 4,
              "choicegroup": null,
              "is_active": true,
              "is_complete": true,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [],
              "name": "Favorite Quote"
            },
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 2,
              "choicegroup": null,
              "is_active": true,
              "is_complete": true,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [
                19
              ],
              "name": "TEL"
            },
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 3,
              "choicegroup": null,
              "is_active": true,
              "is_complete": true,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [
                19
              ],
              "name": "Comment"
            },
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 1,
              "choicegroup": null,
              "is_active": true,
              "is_complete": true,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [
                19,
                20
              ],
              "name": "Name"
            },
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 12,
              "choicegroup": null,
              "is_active": true,
              "is_complete": false,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [],
              "name": "Mother"
            },
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 11,
              "choicegroup": null,
              "is_active": true,
              "is_complete": false,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [],
              "name": "Age"
            },
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 10,
              "choicegroup": null,
              "is_active": true,
              "is_complete": false,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [],
              "name": "Gender"
            }
          ],
          "node_type": "user",
          "allowed_cc_users_ids": [],
          "is_notifying_member_on_enter": false,
          "__id__": 19,
          "__model__": "ProcessFlowNode",
          "autocomplete_deadline": 0,
          "job_assignment_type": "",
          "user": null,
          "require_all_cc_response": false,
          "required_fields": [
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 2,
              "choicegroup": null,
              "is_active": true,
              "is_complete": true,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [
                19
              ],
              "name": "TEL"
            },
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 3,
              "choicegroup": null,
              "is_active": true,
              "is_complete": true,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [
                19
              ],
              "name": "Comment"
            },
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 1,
              "choicegroup": null,
              "is_active": true,
              "is_complete": true,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [
                19,
                20
              ],
              "name": "Name"
            }
          ],
          "as_specified": false,
          "is_active": true,
          "trigger_workflow": null
        },
        {
          "trigger_workflow_field_content": {},
          "job_assignment_node": null,
          "allow_cc": true,
          "allowed_cc_groups_ids": [],
          "as_doc_creator": true,
          "autocomplete_condition": null,
          "editable_fields": [
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 1,
              "choicegroup": null,
              "is_active": true,
              "is_complete": true,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [
                19,
                20
              ],
              "name": "Name"
            }
          ],
          "note": "Begin",
          "is_complete": false,
          "children_set_ids": [
            19
          ],
          "allowed_cc_departments_ids": [],
          "n_sign": 1,
          "organization_name": "Hypo",
          "organization_id": 1,
          "deadline": 0,
          "visible_fields": [
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 4,
              "choicegroup": null,
              "is_active": true,
              "is_complete": true,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [],
              "name": "Favorite Quote"
            },
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 3,
              "choicegroup": null,
              "is_active": true,
              "is_complete": true,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [
                19
              ],
              "name": "Comment"
            },
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 1,
              "choicegroup": null,
              "is_active": true,
              "is_complete": true,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [
                19,
                20
              ],
              "name": "Name"
            },
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 12,
              "choicegroup": null,
              "is_active": true,
              "is_complete": false,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [],
              "name": "Mother"
            },
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 11,
              "choicegroup": null,
              "is_active": true,
              "is_complete": false,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [],
              "name": "Age"
            },
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 10,
              "choicegroup": null,
              "is_active": true,
              "is_complete": false,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [],
              "name": "Gender"
            }
          ],
          "node_type": "user",
          "allowed_cc_users_ids": [],
          "is_notifying_member_on_enter": false,
          "__id__": 20,
          "__model__": "ProcessFlowNode",
          "autocomplete_deadline": 0,
          "job_assignment_type": "",
          "user": null,
          "require_all_cc_response": false,
          "required_fields": [
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 1,
              "choicegroup": null,
              "is_active": true,
              "is_complete": true,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [
                19,
                20
              ],
              "name": "Name"
            }
          ],
          "as_specified": false,
          "is_active": true,
          "trigger_workflow": null
        }
      ]
    },
    {
      "fieldtable": null,
      "__model__": "DocumentField",
      "organization_id": 1,
      "fulfill_by_nodes_ids": [
        19
      ],
      "name": "TEL",
      "organization_name": "Hypo",
      "organization": { ... },
      "data_type": "UTF8",
      "__id__": 2,
      "choicegroup": null,
      "is_active": true,
      "is_complete": true,
      "fulfill_by_nodes": [
        {
          "trigger_workflow_field_content": {},
          "job_assignment_node": null,
          "allow_cc": true,
          "allowed_cc_groups_ids": [],
          "as_doc_creator": true,
          "autocomplete_condition": null,
          "editable_fields": [
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 2,
              "choicegroup": null,
              "is_active": true,
              "is_complete": true,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [
                19
              ],
              "name": "TEL"
            },
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 3,
              "choicegroup": null,
              "is_active": true,
              "is_complete": true,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [
                19
              ],
              "name": "Comment"
            },
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 1,
              "choicegroup": null,
              "is_active": true,
              "is_complete": true,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [
                19,
                20
              ],
              "name": "Name"
            }
          ],
          "note": "Middle",
          "is_complete": false,
          "children_set_ids": [
            18
          ],
          "allowed_cc_departments_ids": [],
          "n_sign": 1,
          "organization_name": "Hypo",
          "organization_id": 1,
          "deadline": 0,
          "visible_fields": [
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 4,
              "choicegroup": null,
              "is_active": true,
              "is_complete": true,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [],
              "name": "Favorite Quote"
            },
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 2,
              "choicegroup": null,
              "is_active": true,
              "is_complete": true,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [
                19
              ],
              "name": "TEL"
            },
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 3,
              "choicegroup": null,
              "is_active": true,
              "is_complete": true,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [
                19
              ],
              "name": "Comment"
            },
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 1,
              "choicegroup": null,
              "is_active": true,
              "is_complete": true,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [
                19,
                20
              ],
              "name": "Name"
            },
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 12,
              "choicegroup": null,
              "is_active": true,
              "is_complete": false,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [],
              "name": "Mother"
            },
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 11,
              "choicegroup": null,
              "is_active": true,
              "is_complete": false,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [],
              "name": "Age"
            },
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 10,
              "choicegroup": null,
              "is_active": true,
              "is_complete": false,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [],
              "name": "Gender"
            }
          ],
          "node_type": "user",
          "allowed_cc_users_ids": [],
          "is_notifying_member_on_enter": false,
          "__id__": 19,
          "__model__": "ProcessFlowNode",
          "autocomplete_deadline": 0,
          "job_assignment_type": "",
          "user": null,
          "require_all_cc_response": false,
          "required_fields": [
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 2,
              "choicegroup": null,
              "is_active": true,
              "is_complete": true,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [
                19
              ],
              "name": "TEL"
            },
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 3,
              "choicegroup": null,
              "is_active": true,
              "is_complete": true,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [
                19
              ],
              "name": "Comment"
            },
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 1,
              "choicegroup": null,
              "is_active": true,
              "is_complete": true,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [
                19,
                20
              ],
              "name": "Name"
            }
          ],
          "as_specified": false,
          "is_active": true,
          "trigger_workflow": null
        }
      ]
    },
    {
      "fieldtable": null,
      "__model__": "DocumentField",
      "organization_id": 1,
      "fulfill_by_nodes_ids": [
        19
      ],
      "name": "Comment",
      "organization_name": "Hypo",
      "organization": { ... },
      "data_type": "UTF8",
      "__id__": 3,
      "choicegroup": null,
      "is_active": true,
      "is_complete": true,
      "fulfill_by_nodes": [
        {
          "trigger_workflow_field_content": {},
          "job_assignment_node": null,
          "allow_cc": true,
          "allowed_cc_groups_ids": [],
          "as_doc_creator": true,
          "autocomplete_condition": null,
          "editable_fields": [
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 2,
              "choicegroup": null,
              "is_active": true,
              "is_complete": true,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [
                19
              ],
              "name": "TEL"
            },
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 3,
              "choicegroup": null,
              "is_active": true,
              "is_complete": true,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [
                19
              ],
              "name": "Comment"
            },
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 1,
              "choicegroup": null,
              "is_active": true,
              "is_complete": true,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [
                19,
                20
              ],
              "name": "Name"
            }
          ],
          "note": "Middle",
          "is_complete": false,
          "children_set_ids": [
            18
          ],
          "allowed_cc_departments_ids": [],
          "n_sign": 1,
          "organization_name": "Hypo",
          "organization_id": 1,
          "deadline": 0,
          "visible_fields": [
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 4,
              "choicegroup": null,
              "is_active": true,
              "is_complete": true,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [],
              "name": "Favorite Quote"
            },
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 2,
              "choicegroup": null,
              "is_active": true,
              "is_complete": true,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [
                19
              ],
              "name": "TEL"
            },
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 3,
              "choicegroup": null,
              "is_active": true,
              "is_complete": true,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [
                19
              ],
              "name": "Comment"
            },
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 1,
              "choicegroup": null,
              "is_active": true,
              "is_complete": true,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [
                19,
                20
              ],
              "name": "Name"
            },
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 12,
              "choicegroup": null,
              "is_active": true,
              "is_complete": false,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [],
              "name": "Mother"
            },
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 11,
              "choicegroup": null,
              "is_active": true,
              "is_complete": false,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [],
              "name": "Age"
            },
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 10,
              "choicegroup": null,
              "is_active": true,
              "is_complete": false,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [],
              "name": "Gender"
            }
          ],
          "node_type": "user",
          "allowed_cc_users_ids": [],
          "is_notifying_member_on_enter": false,
          "__id__": 19,
          "__model__": "ProcessFlowNode",
          "autocomplete_deadline": 0,
          "job_assignment_type": "",
          "user": null,
          "require_all_cc_response": false,
          "required_fields": [
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 2,
              "choicegroup": null,
              "is_active": true,
              "is_complete": true,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [
                19
              ],
              "name": "TEL"
            },
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 3,
              "choicegroup": null,
              "is_active": true,
              "is_complete": true,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [
                19
              ],
              "name": "Comment"
            },
            {
              "organization_name": "Hypo",
              "organization_id": 1,
              "__model__": "DocumentField",
              "data_type": "UTF8",
              "__id__": 1,
              "choicegroup": null,
              "is_active": true,
              "is_complete": true,
              "fieldtable": null,
              "fulfill_by_nodes_ids": [
                19,
                20
              ],
              "name": "Name"
            }
          ],
          "as_specified": false,
          "is_active": true,
          "trigger_workflow": null
        }
      ]
    },
    {
      "fieldtable": null,
      "__model__": "DocumentField",
      "organization_id": 1,
      "fulfill_by_nodes_ids": [],
      "name": "Favorite Quote",
      "organization_name": "Hypo",
      "organization": { ... },
      "data_type": "UTF8",
      "__id__": 4,
      "choicegroup": null,
      "is_active": true,
      "is_complete": true,
      "fulfill_by_nodes": []
    }
  ],
  "field_content": {
    "COMMENT": "ffff"
  },
  "fill_by_current_user": true,
  "title_formula": null,
  "required_job_assignments": [],
  "attachedfiles": [],
  "required_fields": [],
  "comments": [
    {
      "comment": "122333",
      "reject_to_version": null,
      "reject_to_user_id": null,
      "receiver_cc_id": null,
      "datetime": {
        "__value__": "2017-08-15T15:19:45.275180+08:00",
        "__type__": "datetime"
      },
      "submit_signature_id": null,
      "sender_cc_id": 5,
      "is_rejection": false,
      "is_cc_reply": false,
      "user": "yllan",
      "login_user": { ... },
      "user_id": 2
    },
    {
      "comment": "ffff",
      "reject_to_version": null,
      "reject_to_user_id": null,
      "receiver_cc_id": 5,
      "datetime": {
        "__value__": "2017-08-15T15:20:13.490642+08:00",
        "__type__": "datetime"
      },
      "submit_signature_id": null,
      "sender_cc_id": null,
      "is_rejection": false,
      "is_cc_reply": true,
      "user": "admin",
      "login_user": { ... },
      "user_id": 1
    }
  ]
}

CC

/api/mds/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/mds/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/mds/document/cc/list_target/

列出可轉匯人員名單,回傳 users 為可轉匯人員 Array of user object。

document: Document object。 node: Node object,欲查詢可轉匯人員名單之節點。

Request:

curl -X "POST" "https://demo.omnibpm.com/api/mds/document/cc/list_target/" \
     -H "Content-Type: application/json" \
     -d '{
  "document": {
    "__id__": 26
  },
  "node": {
    "__id__": 46
  },
  "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/mds/document/cc/reply/ 回覆 CC

必填參數: document: Document object. user: User object. cc: CC object. comment: String.


Assign Agent

/api/mds/document/assign_agent/

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

必填: document: 文件 user: 目前簽署者的身份 node: 欲指定負責人的節點 agents: List of users. 該節點的負責人

Request:

curl -X "POST" "https://demo.omnibpm.com/api/mds/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"
}