如何在审批阶段Comala API之后获取审批者名称

时间:2018-04-09 09:21:59

标签: rest api workflow confluence

如何使用Comala Rest API获取使用Simple Comala Workflow批准Confluence页面的用户?

批准前,在分配给用户批准后:

b_a_id

响应:

curl -k -X GET -u <username> -H 'Content-Type: application/json' -H 'Accept: application/json' http://<confluence-url>/rest/cw/1/content/<page-id>/status?expand=state,states,approvals,actions,tasks | python -mjson.tool

批准后,回复:

{
    "actions": [
        {
            "actions": [
                "approve",
                "reject",
                "assign",
                "unassign"
            ],
            "involvedUsers": [
                {
                    "fullName": "minzey",
                    "name": "emp_id",
                    "pictureUrl": "/images/icons/profilepics/default.png",
                    "shortName": "minzey"
                },
                {
                    "fullName": "second user",
                    "name": "emp_id",
                    "pictureUrl": "/images/icons/profilepics/default.png",
                    "shortName": "second user"
                }
            ],
            "name": "Review",
            "requiresComment": false,
            "shortName": "Review",
            "type": "approval"
        }
    ],
    "approvals": [
        {
            "approvers": [
                {
                    "approved": false,
                    "rejected": false,
                    "user": {
                        "fullName": "second user",
                        "name": "emp_id",
                        "pictureUrl": "/images/icons/profilepics/default.png",
                        "shortName": "second user"
                    }
                },
                {
                    "approved": false,
                    "rejected": false,
                    "user": {
                        "fullName": "minzey",
                        "name": "emp_id",
                        "pictureUrl": "/images/icons/profilepics/default.png",
                        "shortName": "minzey"
                    }
                }
            ],
            "description": "Requires approval from second user and minzey",
            "filterExcludedUsers": [],
            "filterGroups": [],
            "filterUsers": [],
            "name": "Review",
            "shortName": "RE"
        }
    ],
    "expand": "",
    "messages": [],
    "state": {
        "colour": "#FFAB00",
        "final": false,
        "initial": false,
        "name": "In Progress"
    },
    "states": [
        {
            "approvals": [
                {
                    "approvers": {
                        "minimum": "*"
                    },
                    "name": "Review"
                }
            ],
            "colour": "#FFAB00",
            "name": "In Progress",
            "taskable": true,
            "transitions": {
                "approved": "Approved"
            }
        },
        {
            "colour": "#14892c",
            "final": true,
            "name": "Approved",
            "transitions": {
                "updated": "In Progress"
            }
        }
    ],
    "tasks": [],
    "workflowName": "Simple approval workflow"
}

response.states.approvals.approvers中的信息现在为空。如何使用批准者名称填充此字段。

1 个答案:

答案 0 :(得分:0)

Comala Workflows REST API仅提供有关工作流实际状态的信息。您必须将“审批人”信息解释为“待审批人”,因此一旦获得批准,您将无法检索审批人的信息。 您可以在以下网址获取更多信息:

https://comalatech.bitbucket.io/comala-workflows/5.3.0/restapi/json_ContentWorkflowResponse.html

请注意,批准列表是指“当前状态下的可用批准”。 审批人(https://comalatech.bitbucket.io/comala-workflows/5.3.0/restapi/json_Approvers.html)显示为批准的参数之一。