Resource: Requirement Packages ( /api/requirementpackages )

Requirement Packages collection resource

Root Relation: RequirementPackages

This resource supports the following methods: GET, POST

Methods

GET


Retrieves all (or a subset of) requirement packages that are visible.

This method supports the TQL query parameters tql, $top, $take and $inlinecount. See TQL Topic for more details.

Required Permissions

  • TestManagement/ManageRequirements/View

Supported Expansions

For more details on expansions, please see the Expand help topic.

Status Codes

These are the expected status codes returned by the service. In addition, some other status codes may be returned if either an internal error occurs or there is an authentication issue (such as an expired OAuth token).

StatusDescription
200 - OKReturned if the request was completed successfully.

Example - GET (filtered by TQL Query)

Retrieves packages matching a TQL query.

Request Headers

KeyValueDescription
Acceptapplication/json

Request Parameters

KeyValueDescription
tqlName ~ 'Report'The TQL query to execute.
$top5The maximum number of results to return (defaults to 25).
$skip0Number of results to skip before return the $top number of results matching the query.

Response Headers

KeyValueDescription
Content-Typeapplication/json; charset=utf-8

Response Body

{
  "Skip": 0,
  "Top": 5,
  "Total": 1,
  "Items": [
    {
      "Id": "d009c056-6025-4a5e-a3b9-fc0fa8cf1f2e",
      "ProjectId": "944aa658-8067-42cf-a6a6-ce71535a73bc",
      "Name": "Reports",
      "OrderNumber": 0,
      "Expands": [
        "Children",
        "Parent",
        "Project"
      ],
      "Self": "http://localhost/api/requirementpackage/d009c056-6025-4a5e-a3b9-fc0fa8cf1f2e",
      "Links": [
        {
          "Href": "http://localhost/api/requirementpackage/d009c056-6025-4a5e-a3b9-fc0fa8cf1f2e/children",
          "Rel": "Children"
        },
        {
          "Href": "http://localhost/api/project/944aa658-8067-42cf-a6a6-ce71535a73bc",
          "Rel": "Project"
        }
      ]
    }
  ],
  "Self": "http://localhost/api/api/requirementpackages?tql=Name~'Report'"
}

Status Code

200 - OK

Example - GET (no TQL query)

Retrieves all packages, across all projects.

Request Headers

KeyValueDescription
Acceptapplication/json

Response Headers

KeyValueDescription
Content-Typeapplication/json; charset=utf-8

Response Body

{
  "Skip": 0,
  "Top": 25,
  "Total": 2,
  "Items": [
    {
      "Id": "d009c056-6025-4a5e-a3b9-fc0fa8cf1f2e",
      "ProjectId": "944aa658-8067-42cf-a6a6-ce71535a73bc",
      "Name": "Reports",
      "OrderNumber": 0,
      "Expands": [
        "Children",
        "Parent",
        "Project"
      ],
      "Self": "http://localhost/api/requirementpackage/d009c056-6025-4a5e-a3b9-fc0fa8cf1f2e",
      "Links": [
        {
          "Href": "http://localhost/api/requirementpackage/d009c056-6025-4a5e-a3b9-fc0fa8cf1f2e/children",
          "Rel": "Children"
        },
        {
          "Href": "http://localhost/api/project/944aa658-8067-42cf-a6a6-ce71535a73bc",
          "Rel": "Project"
        }
      ]
    },
    {
      "Id": "7c8ffe51-c584-41d6-8739-8dbd56d5770f",
      "ProjectId": "944aa658-8067-42cf-a6a6-ce71535a73bc",
      "Name": "Data Import",
      "OrderNumber": 0,
      "Expands": [
        "Children",
        "Parent",
        "Project"
      ],
      "Self": "http://localhost/api/requirementpackage/7c8ffe51-c584-41d6-8739-8dbd56d5770f",
      "Links": [
        {
          "Href": "http://localhost/api/requirementpackage/7c8ffe51-c584-41d6-8739-8dbd56d5770f/children",
          "Rel": "Children"
        },
        {
          "Href": "http://localhost/api/project/944aa658-8067-42cf-a6a6-ce71535a73bc",
          "Rel": "Project"
        }
      ]
    }
  ],
  "Self": "http://localhost/api/api/requirementpackages"
}

Status Code

200 - OK

POST


Create a new requirement package.

Required Permissions

  • TestManagement/ManageRequirements/Edit

Supported Expansions

For more details on expansions, please see the Expand help topic.

Status Codes

These are the expected status codes returned by the service. In addition, some other status codes may be returned if either an internal error occurs or there is an authentication issue (such as an expired OAuth token).

StatusDescription
201 - CreatedReturned if the request was completed successfully.
403 - ForbiddenReturned if the user does not have permission to create requirement packages in the target project.

Example - POST (top-level package)

Create a new package (at root of project)

Request Headers

KeyValueDescription
Acceptapplication/json

Request Body

{
  "Name": "New Package",
  "ProjectId": "4545fe95-e9c2-40e9-8f4a-3f000d14526f"
}

Response Headers

KeyValueDescription
Locationhttp://localhost/api/requirementpackage/4bb709c2-e0e7-4af3-9f60-a045016a9610
Content-Typeapplication/json; charset=utf-8

Response Body

{
  "Id": "4bb709c2-e0e7-4af3-9f60-a045016a9610",
  "ProjectId": "944aa658-8067-42cf-a6a6-ce71535a73bc",
  "Name": "New Package",
  "OrderNumber": 0,
  "Expands": [
    "Children",
    "Parent",
    "Project"
  ],
  "Self": "http://localhost/api/requirementpackage/4bb709c2-e0e7-4af3-9f60-a045016a9610",
  "Links": [
    {
      "Href": "http://localhost/api/requirementpackage/4bb709c2-e0e7-4af3-9f60-a045016a9610/children",
      "Rel": "Children"
    },
    {
      "Href": "http://localhost/api/project/944aa658-8067-42cf-a6a6-ce71535a73bc",
      "Rel": "Project"
    }
  ]
}

Status Code

201 - Created

Example - POST (child of existing package)

Create a new package (as child of existing package).

Request Headers

KeyValueDescription
Acceptapplication/json

Request Body

{
  "Name": "New Child Package",
  "ParentId": "9bfeb244-06a6-4440-b6b6-a8bcc0847673"
}

Response Headers

KeyValueDescription
Locationhttp://localhost/api/requirementpackage/4bb709c2-e0e7-4af3-9f60-a045016a9610
Content-Typeapplication/json; charset=utf-8

Response Body

{
  "Id": "4bb709c2-e0e7-4af3-9f60-a045016a9610",
  "ParentId": "9bfeb244-06a6-4440-b6b6-a8bcc0847673",
  "Name": "New Child Package",
  "OrderNumber": 0,
  "Expands": [
    "Children",
    "Parent",
    "Project"
  ],
  "Self": "http://localhost/api/requirementpackage/4bb709c2-e0e7-4af3-9f60-a045016a9610",
  "Links": [
    {
      "Href": "http://localhost/api/requirementpackage/4bb709c2-e0e7-4af3-9f60-a045016a9610/children",
      "Rel": "Children"
    },
    {
      "Href": "http://localhost/api/requirementpackage/9bfeb244-06a6-4440-b6b6-a8bcc0847673",
      "Rel": "Parent"
    }
  ]
}

Status Code

201 - Created

  • No labels