Requirement APIs

Get All Requirement Fields

GET /api/v3/projects/{projectId}/settings/requirements/fields

qTest version: 4+

Description: To get all active Requirement's fields.

Path variable:

  • projectId: ID of the project

Request sample:

GET /api/v3/projects/14921/settings/requirements/fields HTTP/1.1
Host: nephele.qTestnet.com
Content-Type: application/json
Authorization: bearer [token]
Cache-Control: no-cache

Response sample:

[
  {
    "links": [
      {
        "rel": "self",
        "href": "https://nephele.qTestnet.com/api/v3/projects/14921/608893"
      }
    ],
    "id": 608893,
    "attribute_type": "Number",
    "label": "Status",
    "required": true,
    "constrained": true,
    "order": 1,
    "allowed_values": [
      {
        "links": [],
        "value": 911,
        "label": "New",
        "order": 1,
        "is_default": true,
        "is_active": true
      },
      {
        "links": [],
        "value": 912,
        "label": "In Progress",
        "order": 2,
        "is_default": false,
        "is_active": true
      },
      {
        "links": [],
        "value": 913,
        "label": "Ready For Baseline",
        "order": 3,
        "is_default": false,
        "is_active": true
      },
      {
        "links": [],
        "value": 914,
        "label": "Baselined",
        "order": 4,
        "is_default": false,
        "is_active": true
      }
    ],
    "multiple": false,
    "data_type": 3,
    "searchable": false,
    "free_text_search": false,
    "search_key": "stat",
    "system_field": true,
    "original_name": "Status",
    "is_active": true
  },
  {
    "links": [
      {
        "rel": "self",
        "href": "https://nephele.qTestnet.com/api/v3/projects/14921/608894"
      }
    ],
    "id": 608894,
    "attribute_type": "Number",
    "label": "Priority",
    "required": false,
    "constrained": true,
    "order": 2,
    "allowed_values": [
      {
        "links": [],
        "value": 901,
        "label": "Must have",
        "order": 1,
        "is_default": true,
        "is_active": true
      },
      {
        "links": [],
        "value": 902,
        "label": "Should have",
        "order": 2,
        "is_default": false,
        "is_active": true
      },
      {
        "links": [],
        "value": 903,
        "label": "Nice to have",
        "order": 3,
        "is_default": false,
        "is_active": true
      }
    ],
    "multiple": false,
    "data_type": 3,
    "searchable": false,
    "free_text_search": false,
    "search_key": "prt",
    "system_field": true,
    "original_name": "Priority",
    "is_active": true
  },
  {
    "links": [
      {
        "rel": "self",
        "href": "https://nephele.qTestnet.com/api/v3/projects/14921/608895"
      }
    ],
    "id": 608895,
    "attribute_type": "Number",
    "label": "Type",
    "required": false,
    "constrained": true,
    "order": 3,
    "allowed_values": [
      {
        "links": [],
        "value": 801,
        "label": "Functional",
        "order": 1,
        "is_default": true,
        "is_active": true
      },
      {
        "links": [],
        "value": 802,
        "label": "Non-functional",
        "order": 2,
        "is_default": false,
        "is_active": true
      }
    ],
    "multiple": false,
    "data_type": 3,
    "searchable": false,
    "free_text_search": false,
    "search_key": "type",
    "system_field": true,
    "original_name": "Type",
    "is_active": true
  },
  {
    "links": [
      {
        "rel": "self",
        "href": "https://nephele.qTestnet.com/api/v3/projects/14921/608889"
      }
    ],
    "id": 608889,
    "attribute_type": "ArrayNumber",
    "label": "Assigned To",
    "required": false,
    "constrained": true,
    "order": 5,
    "allowed_values": [
      {
        "links": [],
        "value": 3754,
        "label": "Duong Pham",
        "order": 1,
        "is_default": false,
        "is_active": true
      },
      {
        "links": [],
        "value": 5500,
        "label": "Nephele Pro",
        "order": 2,
        "is_default": false,
        "is_active": true
      }
    ],
    "multiple": true,
    "data_type": 5,
    "searchable": false,
    "free_text_search": false,
    "system_field": true,
    "original_name": "Assigned To",
    "is_active": true
  },
  {
    "links": [
      {
        "rel": "self",
        "href": "https://nephele.qTestnet.com/api/v3/projects/14921/608897"
      }
    ],
    "id": 608897,
    "attribute_type": "LongText",
    "label": "Description",
    "required": false,
    "constrained": false,
    "order": 6,
    "multiple": false,
    "data_type": 6,
    "searchable": false,
    "free_text_search": true,
    "search_key": "des",
    "system_field": true,
    "original_name": "Description",
    "is_active": true
  }
]

Get A Requirement By Its ID

GET /api/v3/projects/{projectId}/requirements/{requirementId}

qTest version: 6+

Description: To retrieve a requirement's details using its ID.

Path variable:

  • projectId: ID of the project

  • requirementId: ID of the requirement which you want to retrieve

Request sample:

GET /api/v3/projects/14921/requirements/1193540 HTTP/1.1
Host: nephele.qTestnet.com
Content-Type: application/json
Authorization: --
Cache-Control: no-cache

Response sample:

{
  "links": [
    {
      "rel": "self",
      "href": "https://nephele.qTestnet.com/api/v3/projects/14921/requirements/1193540"
    },
    {
      "rel": "module",
      "href": "https://nephele.qTestnet.com/api/v3/projects/14921/modules/291412"
    }
  ],
  "id": 1193540,
  "name": "Requirement 1",
  "order": 1,
  "pid": "RQ-2",
  "properties": [
    {
      "field_id": 608893,
      "field_value": "911"
    },
    {
      "field_id": 608894,
      "field_value": "901"
    },
    {
      "field_id": 608895,
      "field_value": "801"
    },
    {
      "field_id": 608889,
      "field_value": "[5500]"
    },
    {
      "field_id": 608897,
      "field_value": ""
    }
  ],
  "web_url": "https://nephele.qTestnet.com/p/14921/portal/project#tab=requirements&object=5&id=1193540"
}

Get All Requirements

GET /api/v3/projects/{projectId}/requirements

qTest version: 6+

Description: To retrieve all requirements. You can optionally specify a module in the request parameter to retrieve its requirements.

Path variable:

  • projectId: ID of the project

Request Parameter:

Parameter Required Description
parentId no Specify ID of the parent module to retrieve all of its requirements.
size no The result is paginated. By the default, the number of requirements in each page is 20. You can specify your custom number in this parameter.
page no By default the first page is returned. However, you can specify any page number to retrieve test cases.

Request sample:

GET /api/v3/projects/14921/requirements?parentId=291412 HTTP/1.1
Host: nephele.qTestnet.com
Content-Type: application/json
Authorization: --
Cache-Control: no-cache

Response sample:

[
  {
    "links": [
      {
        "rel": "self",
        "href": "https://nephele.qTestnet.com/api/v3/projects/14921/requirements/1193540"
      },
      {
        "rel": "module",
        "href": "https://nephele.qTestnet.com/api/v3/projects/14921/modules/291412"
      }
    ],
    "id": 1193540,
    "name": "Requirement 1",
    "order": 1,
    "pid": "RQ-2",
    "properties": [
      {
        "field_id": 608893,
        "field_value": "911"
      },
      {
        "field_id": 608894,
        "field_value": "901"
      },
      {
        "field_id": 608895,
        "field_value": "801"
      },
      {
        "field_id": 608889,
        "field_value": "[5500]"
      },
      {
        "field_id": 608897,
        "field_value": ""
      }
    ],
    "web_url": "https://nephele.qTestnet.com/p/14921/portal/project#tab=requirements&object=5&id=1193540"
  },
  {
    "links": [
      {
        "rel": "self",
        "href": "https://nephele.qTestnet.com/api/v3/projects/14921/requirements/1193539"
      },
      {
        "rel": "module",
        "href": "https://nephele.qTestnet.com/api/v3/projects/14921/modules/291412"
      }
    ],
    "id": 1193539,
    "name": "Requirement 2",
    "order": 1,
    "pid": "RQ-1",
    "properties": [
      {
        "field_id": 608893,
        "field_value": "911"
      },
      {
        "field_id": 608894,
        "field_value": "901"
      },
      {
        "field_id": 608895,
        "field_value": "801"
      },
      {
        "field_id": 608889,
        "field_value": "[]"
      },
      {
        "field_id": 608897,
        "field_value": ""
      }
    ],
    "web_url": "https://nephele.qTestnet.com/p/14921/portal/project#tab=requirements&object=5&id=1193539"
  }
]

Get Requirement Traceability Matrix

GET api/v3/projects/{projectId}/requirements/trace-matrix-report

qTest version: 7+

Description: To retrieve Requirements and their covering Test Cases.

Path variable:

  • projectId: ID of the project

Request Parameters:

Parameter Required Description
size no The result is paginated. By default, the number of requirements in each page is 20. You can specify your custom number in this parameter and the maximum number is 1000.
page no By default the first page is returned. However, you can specify any page number to retrieve test cases.
fieldIds no ID(s) of Requirement fields (system or custom fields) which you would like to retrieve. They are separated by commas.

Request sample:

GET /api/v3/projects/5714/requirements/trace-matrix-report?fieldIds=626451,626450 HTTP/1.1
Host: linhdang.qTestnet.com
Authorization: bearer --
Content-Type: application/json
Cache-Control: no-cache

Response body:

Module Field Description
id ID of the module which contains the requirement.
name Name of the module which contains the requirement.
order Order of the Module in qTest Requirements tree
Requirements List of Requirement objects in the module. See the next table for Requirement fields
children List of sub-module objects under this Module, if any
Requirement Field Description
id Requirement ID
name Requirement name
linked-testcases The number of covering Test Cases associated with the Requirement
testcases IDs of covering Test Cases, separated by commas
Values of the additional fields you specified in request parameters are listed in each requirement object

Response sample:

[
  {
    "id": 298040,
    "name": "Manage User Account",
    "order": 8,
    "requirements": [
      {
        "626450": "901",
        "626451": "801",
        "id": "RQ-315",
        "testcases": "TC-118, TC-117",
        "name": "US_Login",
        "linked-testcases": 2
      },
      {
        "626450": "901",
        "626451": "801",
        "id": "RQ-316",
        "testcases": "TC-121, TC-120",
        "name": "US_My Profile",
        "linked-testcases": 2
      },
      {
        "626450": "901",
        "626451": "801",
        "id": "RQ-317",
        "testcases": "TC-119",
        "name": "US_Logout",
        "linked-testcases": 1
      }
    ],
    "children": []
  }
]

Create A Requirement

qTest version: 4+

Description: To create a new requirement. You will need to specify a parent Module in the request parameter.

Path variable:

  • projectId: ID of the project

Request Parameter:

Parameter Required Description
parentId yes The parent module which will contain the newly created requirement. Use this parameter if your qTest version is 6+. For older versions, specify parent_id in the request body.

Request body:

Attribute Name Required Type Description
name True String Requirement name
properties False JSONArray An array of field-value pairs

Request sample:

POST /api/v3/projects/19949/requirements?parentId=1267978 HTTP/1.1
Host: linhdang.qTestnet.com
Authorization: bearer [token]
Content-Type: application/json
Cache-Control: no-cache

{
    "name":"Req created via API",
    "properties":[
            {
                "field_id": 870001,
                "field_value": 913
            }
        ]
}

Response sample:

{
    "links": [
        {
            "rel": "self",
            "href": "https://linhdang.qTestnet.com/api/v3/projects/19949/requirements/2747290"
        },
        {
            "rel": "module",
            "href": "https://linhdang.qTestnet.com/api/v3/projects/19949/modules/1267978"
        }
    ],
    "id": 2747290,
    "name": "Req created via API",
    "order": 1,
    "pid": "RQ-278",
    "properties": [
        {
            "field_id": 870001,
            "field_value": "913"
        },
        {
            "field_id": 870002,
            "field_value": "901"
        },
        {
            "field_id": 870003,
            "field_value": "801"
        },
        {
            "field_id": 869997,
            "field_value": "[]"
        },
        {
            "field_id": 870005,
            "field_value": ""
        }
    ],
    "web_url": "https://linhdang.qTestnet.com/p/19949/portal/project#tab=requirements&object=5&id=2747290"
}

Update A Requirement

PUT /api/v3/projects/{projectId}/requirements/{requirementId}

qTest version: 6+

Description: To update properties of an existing requirement or to move it to other parent module.

Path variable:

  • projectId: ID of the project

  • requirementId: ID of the requirement which needs to be updated

Request body:

Attribute Name Required Type Description
name True String Requirement name
properties False JSONArray An array of field-value pairs

Request sample:

PUT /api/v3/projects/19949/requirements/2747290 HTTP/1.1
Host: linhdang.qTestnet.com
Authorization: bearer [token]
Content-Type: application/json
Cache-Control: no-cache

{
    "name": "Name has been modified - 3"
}

Response sample:

{
    "links": [
        {
            "rel": "self",
            "href": "https://linhdang.qTestnet.com/api/v3/projects/19949/requirements/2747290"
        },
        {
            "rel": "module",
            "href": "https://linhdang.qTestnet.com/api/v3/projects/19949/modules/1267978"
        }
    ],
    "id": 2747290,
    "name": "Name has been modified - 3",
    "order": 1,
    "pid": "RQ-278",
    "properties": [
        {
            "field_id": 870001,
            "field_value": "913"
        },
        {
            "field_id": 870002,
            "field_value": "901"
        },
        {
            "field_id": 870003,
            "field_value": "801"
        },
        {
            "field_id": 869997,
            "field_value": "[]"
        },
        {
            "field_id": 870005,
            "field_value": ""
        }
    ],
    "web_url": "https://linhdang.qTestnet.com/p/19949/portal/project#tab=requirements&object=5&id=2747290"
}

Delete A Requirement

DELETE /api/v3/projects/{projectId}/requirements/{requirementId}

Description: To delete an existing requirement.

Path variable:

  • projectId: ID of the project

  • requirementId: ID of the requirement which needs to be deleted

Create Links Between A Requirement and Test Cases

POST /api/v3/projects/{projectId}/req-tc-links

qTest version: 4+

Description: To create links between a Requirement and a list of Test Cases.

Path variable:

  • projectId: ID of the project

Request sample:

POST /api/v3/projects/19949/req-tc-links HTTP/1.1
Host: linhdang.qTestnet.com
Authorization: bearer [token]
Content-Type: application/json
Cache-Control: no-cache

{
    "requirement_id": 2747290,
    "testcase_ids": [3840916]
}