如何通过 Polarion API 使用查询('queryWorkItems'、'queryWorkItemsBySQL' 等)

How to use queries ('queryWorkItems', 'queryWorkItemsBySQL', etc.) via Polarion API

我正在使用 SOAP API 与 Polarion 服务器通信。在一个 WSDL 文件中,定义了一些用于查询工作项的 Web 服务,但我找不到如何使用它们的示例。 假设我想向服务器询问项目 'My First Project' 中类型为 'Test Case' 的所有工作项。 我应该将哪些参数值传递给 'queryWorkItems' 或 'queryWorkItemsBySQL'?

我找到了以下包含请求结构的文档: https://almdemo.polarion.com/polarion/sdk/doc/javadoc/com/polarion/alm/ws/client/tracker/TrackerWebService.html#queryWorkItems(java.lang.String,java.lang.String,java.lang.String%5B%5D) https://almdemo.polarion.com/polarion/sdk/doc/javadoc/com/polarion/alm/ws/client/tracker/TrackerWebService.html#queryWorkItemsBySQL(java.lang.String,java.lang.String%5B%5D)

不幸的是,我不知道 'query' 或 'sqlQuery' 应该是什么样子。你能提供任何例子吗?

我找到了如何使用 Lucene 查询构建和发送 API 请求。在此视频中,展示了如何构建(自 0:40 起在视频中)并将它们转换为文本格式(自 2:52 起在视频中): https://www.youtube.com/watch?v=DSRKfdr2aJc

在构建 Lucene 格式的 txt 查询后,发送 API 网络服务请求:

queryWorkItems(query, sort, fields)

示例(Python语法):

queryWorkItems(query="project.id:MyProject AND type:testcase", sort="uri", fields=["id", "assignee"])

[工作项字段]的字典 -> [字段类型]:

FIELDS = {
        "approvals": "ArrayOfApproval",
        "assignee": "ArrayOfUser",
        "attachments": "ArrayOfAttachment",
        "author": "User",
        "categories": "ArrayOfCategory",
        "comments": "ArrayOfComment",
        "created": "dateTime",
        "description": "Text",
        "dueDate": "date",
        "externallyLinkedWorkItems": "ArrayOfExternallyLinkedWorkItem",
        "hyperlinks": "ArrayOfHyperlink",
        "id": "string",
        "initialEstimate": "duration",
        "linkedOslcResources": "ArrayOfLinkedOslcResource",
        "linkedRevisions": "ArrayOfRevision",
        "linkedRevisionsDerived": "ArrayOfRevision",
        "linkedWorkItems": "ArrayOfLinkedWorkItem",
        "linkedWorkItemsDerived": "ArrayOfLinkedWorkItem",
        "location": "Location",
        "moduleURI": "SubterraURI",
        "outlineNumber": "string",
        "plannedEnd": "dateTime",
        "plannedIn": "ArrayOfPlan",
        "plannedStart": "dateTime",
        "planningConstraints": "ArrayOfPlanningConstraint",
        "previousStatus": "EnumOptionId",
        "priority": "PriorityOptionId",
        "project": "Project",
        "remainingEstimate": "duration",
        "resolution": "EnumOptionId",
        "resolvedOn": "dateTime",
        "severity": "EnumOptionId",
        "status": "EnumOptionId",
        "timePoint": "TimePoint",
        "timeSpent": "duration",
        "title": "string",
        "type": "EnumOptionId",
        "updated": "dateTime",
        "workRecords": "ArrayOfWorkRecord",
        "customFields": "ArrayOfCustom",
        "uri": "SubterraURI",
        "unresolvable": "boolean",
    }