OmniBPM Restful API

除了 Organization create/activate/inactivate/delete 这四个 API 传入的 api_key 是 master api key 以外,其他呼叫传入的 api 都是 organization 专属的 API。

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

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

model 只是用来储存物件型态的栏位,optional 可省略。填了的话系统会 check,如果形态不一致会报错。

client_extra 可用来存任意的 JSON object 资讯,也是 optional。

另外所有的错误都会是以下形式:

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

如果正确,一定会有

{"RESPONSE": "OK"}

Organization

List

/api/v0.1/organization/list/

Request:

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

Response:

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

Create

/api/v0.1/organization/create/

model 此 object 的型态,optional

name 组织名称

abbr 组织缩写,全大写,不可重复

client_extra 可以存任何的 JSON 物件资讯,例如对应PK和optional。

在 organization 外有个额外的参数: default_structure 代表是否建立预设部门与职等。预设值为 true

Request:

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

Response:

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

如果有重复的 organization name:

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

Inactivate

/api/v0.1/organization/inactivate/

id 必填,OmniBPM 里的 Organization PK。

Request:

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

Response:

{
  "RESPONSE": "OK"
}

Activate

/api/v0.1/organization/activate/

id 必填,OmniBPM 里的 Organization PK。

Request:

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

Response:

{
  "RESPONSE": "OK"
}

Get

/api/v0.1/organization/get/

Request:

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

Response:

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

Update

/api/v0.1/organization/update/

Request:

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

Response:

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

Delete

/api/v0.1/organization/delete/

传入的 api_key 为 master api key。

Request:

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

Response:

{
  "RESPONSE": "OK"
}

Import Users

/api/v0.1/organization/importusers/

display_name:必填,显示用名称

username:必填,登入用帐号

email:必填

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

is_active:必填,是否启用

department:必填,部门

rank:必填,职等

Request:

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

Response:

{
  "RESPONSE": "OK"
}

Department

department object 大致长这样:

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

  • parent_department:上一层的部门,若为 null 则为最高部门。若非 null 则为 department object。只是此 object 内不会再有 parent_department attribute 一直串上去,最多只会有一层。

  • department_head:部门主管,是一个 User Object。

  • is_active:是否启用

  • id:OmniBPM 用的 PK

List

/api/v0.1/department/list/

Request:

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

Response:

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

Create

/api/v0.1/department/create/

Request:

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

Response:

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

Inactivate

/api/v0.1/department/inactivate/

此部门必须没有用户。若此部门下还有用户,会回传 error。

Request:

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

Response:

{
  "RESPONSE": "OK"
}

Activate

/api/v0.1/department/activate/

Request:

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

Response:

{
  "RESPONSE": "OK"
}

Update

/api/v0.1/department/update/

Request:

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

Response:

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

Delete

/api/v0.1/department/delete/

会检查是否有子部门,若有,则不能删除。 另外若流程中有参照到此部门,亦无法删除。

Request:

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

Response:

{
  "RESPONSE": "OK"
}

Rank

{
  "organization": { ... },
  "level": 4,
  "name": "Specialist",
  "is_active": true,
  "__id__": 1234,
  "__model__": "UserRank"
}
  • level 职等,数字越小越高层

  • name 职等名称

List

/api/v0.1/rank/list/

Request:

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

Response:

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

Create

/api/v0.1/rank/create/

level 必填,且不能和现有的 level 重复,否则会有 error。

Request:

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

Response:

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

若 level 有重复,会有错误:

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

Inactivate

/api/v0.1/rank/inactivate/

停用职等,让 is_activefalse。已停用职等仍会出现在 list 的 API 内,通常画面的呈现是用 strike 来表达。停用职等不会改变 level 的值。

Request:

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

Response:

{
  "RESPONSE": "OK"
}

若还有使用者在此职等,停用会发生错误。必须先把 user 指定为别的职等,才能停用。

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

Activate

/api/v0.1/rank/activate/

Request:

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

Response:

{
  "RESPONSE": "OK"
}

Update

/api/v0.1/rank/update/

没办法改 level,只能改 name。要改 level 要用 rank/order API。

Request:

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

Response:

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

Delete

/api/v0.1/rank/delete/

会检查是否有 User 属于此职等。若有则无法删除。 会检查流程中是否有参照到此职等,若有则无法删除。

Request:

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

Response:

{
  "RESPONSE": "OK"
}

Order

/api/v0.1/rank/order/

调整职等的层级。rank_order 传入职等阵列,越前面的职等越高级(level 越小)。已停用的职等也必须传入。

Request:

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

Response:

{
  "RESPONSE": "OK"
}

若传来的 rank_order 有漏掉任何一个 rank,会出现错误

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

User

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

基本结构如上,会有一些额外的栏位(例如 azure_* 是和微软登入相关的)用不到可先忽略。主要用到的栏位有:

  • username 必须是 login@org.abbr 的形式,org.abbr 为大写。

  • display_name 显示用的全名

  • email

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

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

  • id PK

  • rank 职等

  • department 部门

List

/api/v0.1/user/list/

Request:

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

Response:

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

Create

/api/v0.1/user/create/

目前 rank 和 department 虽然是必须的,但若没传会自动带入 default 值。 rank / department 改为必填栏位。 with_admin_permissions: 若为 true 则建立的使用者进入网页后台可以管理组织等。

Request:

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

Response:

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

Inactivate

/api/v0.1/user/inactivate/

Request:

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

Response:

{"RESPONSE": "OK"}

Activate

/api/v0.1/user/activate/

Request:

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

Response:

{"RESPONSE": "OK"}

Update

/api/v0.1/user/update/

能修改的栏位只有

  • rank

  • department (若为已停用 department,会发生错误)

  • display_name

  • email

  • password

  • is_active (功能相当于 user/activateuser/inactivate

  • client_extra

Request:

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

Response:

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

Delete

/api/v0.1/user/delete/

会检查流程中是否有参照到此 User,若有则无法删除。 (群组参照到的话可以删除,删除后群组少一位成员)

Request:

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

Response:

{
  "RESPONSE": "OK"
}

Error: (若该 User 为部门主管时无法删除)

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

Group

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

每个组织预设会有两个群组,All UsersExternal Users。这两个群组内容是系统产生,无法编辑。

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

List

/api/v0.1/group/list/

Request:

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

Response:

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

Create

/api/v0.1/group/create/

name 同一个组织下的 name 必须是唯一值,不可重复。不同组织则可重复。

users 欲加入此群组的人员列表,optional。

Request:

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

Response:

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

Inactivate

/api/v0.1/group/inactivate/

Request:

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

Response:

{"RESPONSE": "OK"}

Activate

/api/v0.1/group/activate/

Request:

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

Response:

{"RESPONSE": "OK"}

Update

/api/v0.1/group/update/

只能改name,如果值没有更新会有 error。 is_active (功能相当于 group/activategroup/inactivate

Request:

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

Response:

{"RESPONSE": "OK"}

如果传入值是原本的 name 会遇到 error

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

Delete

/api/v0.1/group/delete/

删除群组。

Request:

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

Response:

{
    "RESPONSE": "OK"
}

User List

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

列出群组的成员。

Request:

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

Response:

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

User Add

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

不能把 user 加入 All UsersExternal Users 群组,也不能加入inactive的群组。结果会回传目前群组的所有成员。

Request:

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

Response:

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

User Remove

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

Request:

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

Response:

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

Workflow

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

流程的 object 内有几个重要的 attribute,其中 name 是唯一识别,不能重复。

is_complete 之前,流程都可新增删除节点,但呼叫 workflow/finalize 后,is_complete 会变成 true。此时就不能再新增删除节点。只能呼叫 workflow/clone 产生一个新版本来修改。

同样名字的流程可以有好几个版本, version 数字越大的版本越新。

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

Create

/api/v0.1/workflow/create/

Request:

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

Response:

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

name 是唯一值,若传入已存在的流程名字,会产生错误:

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

Clone

/api/v0.1/workflow/clone/

产生一个可以修改的新版本。产生出来的流程 version 会大于所有同名流程的 version,并且可以编辑(is_complete == false)。

Request:

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

Response:

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

Save As

/api/v0.1/workflow/save_as/

将目前流程另存成一个新的名字的流程。

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

new_name: String, 新流程的名字。

Request:

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

Response:

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

List

/api/v0.1/workflow/list/

name: String, optional. 如果有提供的话,只会显示该名称的流程。若无提供,显示全部的流程。

Request:

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

Response:

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

Update

/api/v0.1/workflow/update/

只能修改 name 属性。原本同名的其他 workflow 也会一并被修改。

Request:

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

Response:

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

Finalize

/api/v0.1/workflow/finalize/

完成编辑节点,呼叫后 is_complete 会变成 true,并且流程不能再编辑。

Request:

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

Response:

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

Activate

/api/v0.1/workflow/activate/

将流程设为现行流程(可以建立新的 document),呼叫后 is_active 会是 true,并且把其他版本的流程设为 is_active == false

Request:

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

Response:

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

Inactivate

/api/v0.1/workflow/inactivate/

将流程设为失效(is_active == false,不能创立新文件)。

Request:

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

Response:

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

Hide

/api/v0.1/workflow/hide/

隐藏流程。隐藏后 list 不会被列出来。

Request:

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

Response:

{
  "RESPONSE": "OK"
}

Delete

/api/v0.1/workflow/delete/

删除流程,有产生过文件的流程不能删除。

Request:

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

Response:

{
  "RESPONSE": "OK"
}

Workflow Permission

一个 workflow 权限可以针对

  • user:使用者

  • group:群组

  • department:部门

(以上对象择一)分别设定

  • is_creatable:是否可建立文件

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

  • is_revokable:是否可撤销文件

  • is_revivable:是否可退回已完成文件(状态更改为``进行中'')

(以上权限可同时存在)

权限是所有版本共用一个的,所以如果新版流程修改权限后,旧版也会被影响。

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

List

/api/v0.1/workflow_perm/list/

列出某流程的权限。

  • workflow: Workflow object. 列出该流程的权限设定。

输出格式如 workflow_perm/set/

Request:

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

Response:

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

Set

/api/v0.1/workflow_perm/set/

设定权限

  • workflow:Workflow object. 对某个流程设定权限。

权限设定:

  • creatable_users:Array of User objects.

  • visible_users:Array of User objects.

  • revokable_users:Array of User objects.

  • revivable_users:Array of User objects.

  • creatable_groups:Array of Group objects.

  • visible_groups:Array of Group objects.

  • revokable_groups:Array of Group objects.

  • revivable_groups:Array of Group objects.

  • creatable_departments:Array of Department objects.

  • visible_departments:Array of Department objects.

  • revokable_departments:Array of Department objects.

  • revivable_departments:Array of Department objects.

以上权限阵列若无提供,将视为清除。因此只要全都不传或者传空阵列,就会将权限全部清空。

Request:

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

Response:

{"RESPONSE": "OK"}

Delete

/api/v0.1/workflow_perm/delete/

删除某人/群组/部门对某流程的所有权限。此 API 一次只能删除一个对象的权限。

  • workflow

以下对象只能择一填写:

  • user

  • group

  • department

Request:

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

Response:

{"RESPONSE": "OK"}

Workflow Node

节点的结构比较复杂,不同的 type 会有不同栏位。

必填栏位:

n_sign:此节点要被多少人签过才算完成

note:节点名称

以下栏位不能同时存在,按照“谁可以签”来分类,必须选一种。

  • 部门

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

  • 群组

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

  • 使用者

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

  • 主管签核(设定要签到哪种职等)

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

    • reference_node:主管参考点,若为 null 代表参考流程发起人,否则参考签 reference_node 的人

    • sign_by_at_least_one_supervisor:预设值为 true,至少需要一位主管核准(就算职等已高于要求)

  • 流程发起人

    • as_doc_creator: true

  • 待指定负责人

    • as_specified: true

    • job_assignment_node:在哪个 node 指定签核者。型态为 Workflow Node 的 JSON Object,只要 id key 存在即可。

    • job_assignment_type:字串,有两种值:

      • ASSIGN:代表由 job_assignment_node 的签核者负责指定

      • COPY:代表和 job_assignment_node 的签核者同步,此时 job_assignment_node 必须也是“待指定负责人”才行,否则会有错误。

除了“待指定负责人”的节点以外,其他种类节点的 job_assignment_nodejob_assignment_type 都是 optional,填 null 和 empty string 代表“不需指定负责人”。而唯有“群组”节点支援“同步签核者”(job_assignment_type == COPY ),且被参照的 job_assignment_node 也要是群组节点并且属于同样群组才行。

以下参数非必填:

require_all_cc_response:要所有 CC 使用者都回覆了以后才会继续下一个节点,预设为 false

allow_cc:允许 CC,预设为 true

allowed_cc_departments:Array of Department Objects,代表这些部门里的人都可以被 CC。

allowed_cc_groups:Array of Group Objects,代表这些群组里的人都可以被 CC。

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

autocomplete_condition:String,跳过条件(公式)。条件为真时,跳过此节点不执行。

autocomplete_deadline:Int,秒数。期限过后自动跳过此节点。

如果都没有填写,预设 allowed_cc_groups 为 ``All Users'' 群组。

required_fields:“必填的栏位”,Array of Workflow Field,若没填预设为空。

editable_fields:“可编辑的栏位”,Array of Workflow Field,若没填预设为空。

visible_fields:“可见的栏位”,Array of Workflow Field,若没填预设为目前流程内全部栏位。至少要可以看到一个栏位,不能传空阵列。

“必填栏位”也一定“可编辑”和“可见”,“可编辑”栏位一定“可见”。 若更新 required_fields:[f1], editable_fields:[f2], visible_fields[f3],结果会是 required_fields:[f1], editable_fields[f1, f2], visible_fields[f1, f2, f3]

以下栏位透过特殊 API 操作: children_set:Array of Workflow Node JSON object. 代表子节点。透过 workflow_node/add_childworkflow_node/remove_child 增减。

以下栏位唯读: node_type:值为 department, user, group, userrank 四种。其中“流程发起人”和“待指定负责人”都是 user 型态。

Create

/api/v0.1/workflow_node/create/

1.产生待指定负责人节点

Request:

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

Response:

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

2.产生文件发起人节点:

Request:

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

3.产生 User 节点

Request:

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

4.部门节点

Request:

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

5.群组节点

Request:

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

6.主管签核节点(流程发起人的主管)

Request:

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

List

/api/v0.1/workflow_node/list/

Request:

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

Response:

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

Delete

/api/v0.1/workflow_node/delete/

若删除的节点有指定别的节点的负责人,删除会出错。

Request:

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

Response:

{
    "RESPONSE": "OK"
}

Update

/api/v0.1/workflow_node/update/

workflow_node/create 能传的参数一样,唯独多了 id 指定要修改哪个节点。

注意 此 method 内部的实作为砍掉原本的节点,并且产生一个新的节点取代。节点间的连结关系会维持,因此要注意回传的 id 一定和传入不同。

建议只在同样的节点类型内修改。例如:部门节点修改部门是安全的,但不建议将部门节点修改为群组节点(尚未测试会发生什么事)。

回传:

node:修改过后的 Node 节点

job_assigned_nodes_ids:Array of Integer. 所有由该节点指定签核者的节点 ID

referenced_nodes_ids:Array of Integer. 所有参考该节点的节点 ID

Request:

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

Response:

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

Add Child

/api/v0.1/workflow_node/add_child/

建立节点之间的连结。

Request:

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

Response:

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

Remove Child

/api/v0.1/workflow_node/remove_child/

删除节点间的连结

Request:

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

Response:

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

Workflow Field

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

  • name:栏位名称

  • formula:公式内容

无法删除,是否显示靠 is_active 来决定。

Create

/api/v0.1/workflow_field/create/

建立时预设会让流程内全部的节点看到(visible_fields)。如果要更改设定,请利用 workflow_node/update API。

Request:

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

Response:

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

Batch

/api/v0.1/workflow_field/batch/

一次建立多个栏位。

fields 欲建立的栏位列表。

Request:

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

Response:

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

List

/api/v0.1/workflow_field/list/

Request:

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

Response:

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

Activate

/api/v0.1/workflow_field/activate/

workflow:Workflow object. 针对该流程加入栏位。

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

Request:

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

Response:

{
    "RESPONSE": "OK"
}

Inactivate

/api/v0.1/workflow_field/inactivate/

workflow:Workflow object. 针对该流程删除栏位。

fields:Array of field object. 欲删除的栏位。

Request:

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

Response:

{
    "RESPONSE": "OK"
}

Update

/api/v0.1/workflow_field/update/

workflow:流程

field 可更新栏位:

  • name:栏位名称

  • formula:当 field type 为 FORMULA 型态时才可传,内容是公式

  • visible_nodes:可视栏位

Request:

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

Response:

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

Document

Document object 中重要栏位如下:

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

  • creation_time:Date object,文件建立时间。

  • last_time:Date object,文件最后修改时间。

  • completion_time:Date object,文件完成时间。

  • current_nodes:Array of node object,目前进行的节点。

  • completed_nodes:Array of node object,已完成的节点。

  • current_users:Array of user object,目前进行节点的负责人。

  • current_responsible_users:Array of user object,目前进行节点的负责人加上被 CC 要回应的人员。

  • signed_users:Array of user object,签过名的使用者。

  • workflow:流程。

  • signatures:Array of signature object。

  • comments:Array of comment。

  • filled_fields:Array of field object,所有填过的栏位。

  • cc_list:Array of cc object。

  • latest_version:整数,文件的最新版本号。

  • is_cancelled:是否被取消。

  • is_hidden:是否被隐藏。

  • is_revoked:是否被撤回。

  • is_complete:是否完成。

  • title:String,文件标题。

Signature

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

效能考量,注意 Signature 内没有再展开物件,只用 id 来记录。

重要栏位:

  • user_id:签名 User 的 ID。

  • creation_time:签名时间。

  • document_id:文件 ID。

  • version:签在哪个版本上。

  • type:值为 NEXT | REJ | CC

  • is_invalidated:Boolean,是否被退回。

  • fulfilled_fields_ids:Array of ID,签了哪些栏位。

  • fulfilled_nodes_ids:Array of ID,满足哪些节点。

  • completed_nodes_ids:Array of ID,完成哪些节点。

CC

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

效能考量,注意 CC 内没有再展开物件,只用 id 来记录。

重要栏位:

  • from_user_id:CC 发起使用者 ID。

  • to_user_id:被 CC 的使用者 ID。

  • sender_comment_version:CC 发起时文件的版本号。

  • receiver_comment_version:回覆 CC 时文件的版本号,-1 为尚未回覆。

Comment: Comment 物件并无 ID,是由 document 的资料 derive 出来的。

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

重要栏位:

  • comment:字串,comment 内容。

  • datetime:建立时间。

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

  • reject_to_user_id:若 is_rejectiontrue,则此栏位为退回到的 user id,否则为 null

  • reject_to_version:若 is_rejectiontrue,则此栏位为退回到的文件版本,否则为 null

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

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

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

Create

/api/v0.1/document/create/

必填:

workflow:流程

creator:流程发起人,User object

document:文件内容,包括

  • title:文件标题

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

Request:

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

Response: 参考 Document Get 的格式。

List

/api/v0.1/document/list/

current_user:使用者

以下条件必须至少一个。各个条件是联集(OR)运算。

current_document:Boolean,TODO 里的文件

signed_document:Boolean,current_user 签过的文件。

archived_document:Boolean,封存的文件。

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

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

以下条件为 optional,会是交集(AND)运算。

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

created_after:建立时间晚于(包含)此时的文件。

created_before:建立时间早于(包含)此时的文件。

时间的格式如下:

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

结果会根据文件状态分成四个 array,分别是:

  • processing 未完成文件。

  • completed 已完成文件。

  • revoked 已撤回文件。

  • cancelled 已取消文件。

内容为简化后的 object:

  • creator_id:建立者的 ID

  • creator_username:建立者的 username

  • creator_display_name:建立者的显示名称

  • latest_version:文件最新的版本号

  • last_time:文件最后更动时间

  • creation_time:文件建立时间

  • title:文件标题

  • workflow_name:流程名称

  • workflow_id:流程 ID

  • id:文件 ID

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

Request:

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

Response:

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

Submit

/api/v0.1/document/submit/

必填:

document: Document object,里面必须包含

  • latest_version:若 latest_version 并非最新版,代表有其他人已经签过,手上的资料是过时的,要抓取新的 document 资料。此时会回覆 {"RMSG": "Outdated Document Version:Outdated document.", "RESPONSE": "Outdated Document Version"},请用 document/get 抓取更新资料后再重送。

  • field_content:表单内容,是一个 Dictionary,key 为 field_id,value 按照 field data_type 有不同格式:

    • INT123

    • UTF8"Free text"

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

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

    • BOOLtrue / false

user:签这份文件的身份,必须是目前正在进行的任一节点的负责人才行。否则会发生错误。

comment:签署文件下的注解。

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

回传:

  • version:签完产生的版本

  • document:只有 id

  • is_completed:文件是否完成

Request:

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

Response:

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

Reject

/api/v0.1/document/reject/

必填:

document:目前文件

user:发动退回的使用者

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

comment:退回文件的注解

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

Request:

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

Response:

{
  "RESPONSE": "OK"
}

Revoke

/api/v0.1/document/revoke/ 已完成的文件,可以被撤回。若状态非已完成,会产生错误。

参数:

document:Document object.

user:User object.

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

Request:

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

Response:

{
  "RESPONSE": "OK"
}

Cancel

/api/v0.1/document/cancel/ 在文件还没完成以前,发起人可以取消文件。

参数:

document:Document object.

user:User object.

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

Request:

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

Response:

{
  "RESPONSE": "OK"
}

Get

/api/v0.1/document/get/

必填:

document:Document object

user:User object,API 会标记该 user 已读此文件

version:版本,不传预设为 0(最新版)。

Request:

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

回传: 在 document object 内,还有以下栏位:

unused_fields:Array of Workflow field object

hidden_fields:Array of Workflow field object

required_fields:Array of Workflow field object

document_fields:Array of Workflow field object

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

logs:Array of log object

signatures:Array of Signature object

comments:Array of Comment object

current_nodes:Array of Workflow node object

completed_nodes:Array of Workflow node object

required_job_assignments:Array of Workflow node object

nodes:Array of Workflow node object

current_users:Array of User object

signed_users:Array of User object

供 UI 判断显示按钮用:

is_rejectable:Boolean,是否显示 reject 按钮

is_submittable:Boolean,是否显示 submit 按钮

is_cancellable:Boolean,是否显示 cancel 按钮

allow_cc_for_user:Boolean,是否显示 CC 按钮

is_cc_responsible:Boolean,是否显示 reply 按钮

is_cc_reply_readable:Boolean,是否显示 read 按钮

Response:

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

CC

/api/v0.1/document/cc/

转汇文件。

参数:

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

from_user:User object,谁发起转汇。

to_user:User object,转汇给谁。

reply_required:Boolean,是否需要回覆。

comment:String,转汇的讯息。

node:Node object,从哪个节点发起转汇。

Request:

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

Response:

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

CC List Target

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

根据传入 document 以及 user,列出该 user 所在节点之可转汇人员名单(若该 user 同时在多个节点上,回传名单联集)。回传 users 为可转汇人员 Array of user object。

document:Document object。

user:User object。

Request:

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

Response:

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

CC Reply

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

必填参数:

document:Document object.

user:User object.

cc:CC object.

comment:String.

Request:

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

Response:

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

Assign Agent

/api/v0.1/document/assign_agent/

当遇到“待指定负责人”的节点时,需要指定该节点的负责人即为此 API。对一个节点可指定复数的人员。

必填:

document:文件

user:目前签署者的身份

node:欲指定负责人的节点

agents:List of users. 该节点的负责人

Request:

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

Response:

{
  "RESPONSE": "OK"
}

Log

/api/v0.1/document/log

显示文件的编辑纪录。

Document Log 格式如下:

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

若 user=A, delegated_user=B,代表实际上由 B 代理 A,以 A 的身份做动作。 若无代理则 user == delegated_user。

其中 action / type 决定了此笔 log 的类型。Restful API 能产生的类型如下:

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

  • action = sign, type = sign: 签核。额外栏位: signature:Signature object. comment:string。

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

  • action = change, type = designate: 指定负责人。额外栏位: node:Workflow Node Object。被指定的节点 users:Array of User Object。被指定的使用者。

  • action = cc, type = to_user 发起 CC。额外栏位: cc:CC Object。 comment:string。

  • action = cc_reply, type = cc_read 已读 / 回覆 CC。额外栏位: cc:CC Object。 comment:string。

(web 介面可能产生更多类型,例如上传档案、tag、priority 等,在此就没列出)

Request:

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

Response:

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