Get opened defects that I must test for a sprint
The following flow demonstrates how to get a list of the new defects assigned to you, a QA tester, for a specific release and sprint.
Entity relationship diagram
We need to access the following entities for this flow, and understand the relationships between these entities.
The following shows the relations in the flow.
Entity | Relationships in this flow | Description of relationship | Reference / relationship fields |
---|---|---|---|
Defect | Workspace User | Each defect can be assigned to a QA tester. In this flow, that workspace user is you. | qa_owner |
Defect | Phase | Each defect has a phase (status). In this flow, we are interested Opened defects. | phase |
Defect | Release | Each defect can be assigned to a release. | release |
Defect | Sprint | Each defect can be assigned to a specific sprint in the release. | sprint |
Sprint | Release | Each sprint is associated with a release. | release |
Flow
Let's create the REST API call step-by-step.
-
To list all the defects in the workspace:
GET .../api/shared_spaces/<space_id>/workspaces/<workspace_id>/defects
-
Let's build our query_clause. We are only interested in the new defects that are assigned to me and are associated with a specific release and sprint.
This query has four sets of criteria: The release, the sprint, the phase (status), and the owner. We separate each set with a semi-colon (;), which represents the And operator.
Let's start with the first set of criteria, which will be filtering by the phase of the story.
This is similar to working with list nodes. We want to compare the defect's phase with the logical_name whose value is opened.
GET .../api/shared_spaces/<space_id>/workspaces/<workspace_id>/defects?query="phase EQ {logical_name EQ ^phase.defect.opened^}"
-
Now let's filter by the qa_owner. Assuming my QA owner ID is 1001, this query will list any defect that is opened and is assigned to me.
GET .../api/shared_spaces/<space_id>/workspaces/<workspace_id>/defects?query="phase EQ {logical_name EQ ^phase.defect.opened^};qa_owner EQ {id EQ 1001}"
-
Let's filter now by the release. We use the reference field release and filter the releases using the name field and the * wildcard. This lists any release that starts with 941.
GET .../api/shared_spaces/<space_id>/workspaces/<workspace_id>/defects?query="phase EQ {logical_name EQ ^phase.defect.opened^};qa_owner EQ {id EQ 1001};release EQ {name EQ ^941*^}"
-
The last criteria is to filter by the sprint. We use the reference field name to access Sprint 1.
GET .../api/shared_spaces/<space_id>/workspaces/<workspace_id>/defects?query="phase EQ {logical_name EQ ^phase.defect.opened^};qa_owner EQ {id EQ 1001};release EQ {name EQ ^941*^};sprint EQ {name EQ ^Sprint 1^}"
The complete REST API call for this flow is:
GET .../api/shared_spaces/<space_id>/workspaces/<workspace_id>/defects?query="phase EQ {logical_name EQ ^phase.defect.opened^};qa_owner EQ {id EQ 1001};release EQ {name EQ ^941*^};sprint EQ {name EQ ^Sprint 1^}"
See also: