0

I am using SOAP API to communicate with Polarion server. In one of WSDL files, there are defined a few webservices to query work items, but I could not find a single example how to use them. Let say that I want to ask the server for all work items that are 'Test Case' type in project 'My First Project'. What parameter values should I pass to 'queryWorkItems' or 'queryWorkItemsBySQL'?

I have found following documentation with structure of the requests: 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)

Unfortunately I have no idea what 'query' or 'sqlQuery' should be like.. Could you provide any examples?

Maciek
  • 463
  • 8
  • 22

1 Answers1

1

I have found how to build and send API requests with Lucene queries. In this video, there is shown how to build (in video since 0:40) and convert them in text format (in video since 2:52): https://www.youtube.com/watch?v=DSRKfdr2aJc

Once you have txt query in Lucene format build, you send API webservice request:

queryWorkItems(query, sort, fields)

Example (Python syntax):

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

Dictionary of [Work Item field] -> [field type]:

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",
    }
Maciek
  • 463
  • 8
  • 22
  • can you have all fields without passing it individually? – shahooo Oct 23 '20 at 14:42
  • As far as I know, it is not possible (you need to pass each field except 'uri'). – Maciek Oct 25 '20 at 06:41
  • Can you give me the list of all fields? so that I can use it while querying. in [item1,item2,item3] format – shahooo Oct 26 '20 at 11:28
  • Added a dictionary in a comment. You can do ```FIELDS.keys()``` to have this list you asked. It also defined in WSDL files (e.g. https://almdemo.polarion.com/polarion/ws/services/TrackerWebService?wsdl ). More info: https://almdemo.polarion.com/polarion/sdk/doc/sdk.pdf – Maciek Oct 26 '20 at 13:05
  • I need your help in the implementation of another big task that I have right now. will you help? – shahooo Oct 26 '20 at 13:59
  • Are you sharing the repository somewhere? If so, invite me to project (github/gitlab/other?), I will help when I have time. – Maciek Oct 28 '20 at 13:18
  • no, actually it is in the internal network of my organization. Is there any other way that we can connect? – shahooo Oct 30 '20 at 04:03
  • Since the product you are working on is private and only you/your company would have gain from it, I think the only reasonable way is sign some kind of contract (e.g. contract of mandate). There is link to my LinkedIn profile availble in my stack profile if you decide. If you decide to make your product public, I would gladly contribute to it for free. – Maciek Oct 30 '20 at 07:35