You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

Resource: Requirement ( /api/requirement/{id} )

Requirement resource

This resource supports the following methods: DELETE, GET, PUT

Methods

DELETE


Delete a requirement.

Required Permissions

  • TestManagement/ManageRequirements

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.
403 - ForbiddenReturned if you don not have the permissions required to delete the requirement.
404 - NotFoundReturned if the requirement does not exist.

Example - DELETE

Delete a requirement with no children.

Request Headers

KeyValueDescription
Acceptapplication/json

Request Parameters

KeyValueDescription
{id}4bb709c2-e0e7-4af3-9f60-a045016a9610Unique identifier of the requirement to delete.

Response Headers

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

Status Code

200 - OK

Example - DELETE (when requirement has children).

Delete a requirement which has children. When deleteChildren is not set a forbidden status to be returned.

Request Headers

KeyValueDescription
Acceptapplication/json

Request Parameters

KeyValueDescription
{id}4bb709c2-e0e7-4af3-9f60-a045016a9610Unique identifier of the requirement to delete.

Response Headers

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

Response Body

{
  "Message": "The requirement has children."
}

Status Code

403 - Forbidden

Example - Delete requirement and children.

Delete requirement and all its children.

Request Headers

KeyValueDescription
Acceptapplication/json

Request Parameters

KeyValueDescription
{id}4bb709c2-e0e7-4af3-9f60-a045016a9610Unique identifier of the requirement to delete.
deleteChildrentrueForces deletion of children.

Response Headers

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

Status Code

200 - OK

GET


Retrieves a single requirement by its unique Identifier.

Required Permissions

  • TestManagement/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.
403 - ForbiddenReturned if you do not have permission to view this requirement.
404 - NotFoundReturned if no requirement with that identifier exists.

Example - GET

Retrieves a requirement by its unique identifier.

Request Headers

KeyValueDescription
Acceptapplication/json

Request Parameters

KeyValueDescription
{id}4bb709c2-e0e7-4af3-9f60-a045016a9610Unique identifier of the requirement to retrieve.

Response Headers

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

Response Body

{
  "Id": "4bb709c2-e0e7-4af3-9f60-a045016a9610",
  "Name": "Report pagination",
  "AssignedToId": "191375f2-ae6e-4b52-8bed-4192e34b6486",
  "AssignedTo": "joeb",
  "Description": "Check report pagination works correctly",
  "PriorityId": "fe92720f-3fbd-4e49-a3b2-309f6a0a062a",
  "StatusId": "62daf195-0a65-400f-af4b-7fda3d529acb",
  "TypeId": "cfe51645-8179-4fe5-ada3-c145a64d0a05",
  "DifficultyLevelId": "47b4b0cc-22ee-4993-8ed5-ef1dec40a0d2",
  "CreatedAt": "2012-01-01T14:04:05Z",
  "LastUpdatedAt": "2012-02-02T15:05:06Z",
  "CreatedById": "191375f2-ae6e-4b52-8bed-4192e34b6486",
  "CreatedBy": "joeb",
  "LastUpdatedById": "191375f2-ae6e-4b52-8bed-4192e34b6486",
  "LastUpdatedBy": "joeb",
  "Number": 1,
  "EstimatedDuration": null,
  "PackageId": "0f2c3a76-bbd1-4370-8faa-6aacb52f1a01",
  "ParentId": null,
  "OrderNumber": 0,
  "ProjectId": "27dcaff0-1f8a-4dff-b49a-bb3d9f7153b3",
  "ProjectName": "Test Project",
  "ParentName": null,
  "PackageName": "Cycle 1",
  "ChangeComment": null,
  "VersionNumber": 0,
  "HasAttachments": false,
  "Expands": [
    "FieldControls",
    "FieldValues",
    "Package"
  ],
  "Self": "http://localhost/api/requirement/4bb709c2-e0e7-4af3-9f60-a045016a9610",
  "Links": [
    {
      "Href": "http://localhost/api/requirement/4bb709c2-e0e7-4af3-9f60-a045016a9610/relationships",
      "Rel": "Relationships"
    },
    {
      "Href": "http://localhost/api/requirement/4bb709c2-e0e7-4af3-9f60-a045016a9610/allrelationships",
      "Rel": "AllRelationships"
    },
    {
      "Href": "http://localhost/api/requirement/4bb709c2-e0e7-4af3-9f60-a045016a9610/comments",
      "Rel": "Comments"
    }
  ]
}

Status Code

200 - OK

PUT


Updates an existing requirement.

Required Permissions

  • TestManagement/ManageRequirements

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.
403 - ForbiddenReturned if ET did not complete request (normally due to a validation failure or invalid permissions to complete the request).
404 - NotFoundReturned if the requirement does not exist.

Example - PUT (rename requirement)

Example of renaming a requirement.

Request Headers

KeyValueDescription
Acceptapplication/json
Content-typeapplication/json

Request Parameters

KeyValueDescription
{id}4bb709c2-e0e7-4af3-9f60-a045016a9610Unique identifier of the requirement to update.

Request Body

{ "Name": "Updated name" }

Response Headers

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

Response Body

{
  "Id": "4bb709c2-e0e7-4af3-9f60-a045016a9610",
  "Name": "Updated name",
  "AssignedToId": null,
  "AssignedTo": null,
  "Description": null,
  "PriorityId": "fe92720f-3fbd-4e49-a3b2-309f6a0a062a",
  "StatusId": "62daf195-0a65-400f-af4b-7fda3d529acb",
  "TypeId": "cfe51645-8179-4fe5-ada3-c145a64d0a05",
  "DifficultyLevelId": "47b4b0cc-22ee-4993-8ed5-ef1dec40a0d2",
  "CreatedAt": "2012-01-01T14:04:05Z",
  "LastUpdatedAt": "2012-02-02T15:05:06Z",
  "CreatedById": "191375f2-ae6e-4b52-8bed-4192e34b6486",
  "CreatedBy": "joeb",
  "LastUpdatedById": "191375f2-ae6e-4b52-8bed-4192e34b6486",
  "LastUpdatedBy": "joeb",
  "Number": 1,
  "EstimatedDuration": null,
  "PackageId": "0f2c3a76-bbd1-4370-8faa-6aacb52f1a01",
  "ParentId": null,
  "OrderNumber": 0,
  "ProjectId": "27dcaff0-1f8a-4dff-b49a-bb3d9f7153b3",
  "ProjectName": "Test Project",
  "ParentName": null,
  "PackageName": "Cycle 1",
  "ChangeComment": null,
  "VersionNumber": 0,
  "HasAttachments": false,
  "Expands": [
    "FieldControls",
    "FieldValues",
    "Package"
  ],
  "Self": "http://localhost/api/requirement/4bb709c2-e0e7-4af3-9f60-a045016a9610",
  "Links": [
    {
      "Href": "http://localhost/api/requirement/4bb709c2-e0e7-4af3-9f60-a045016a9610/relationships",
      "Rel": "Relationships"
    },
    {
      "Href": "http://localhost/api/requirement/4bb709c2-e0e7-4af3-9f60-a045016a9610/allrelationships",
      "Rel": "AllRelationships"
    },
    {
      "Href": "http://localhost/api/requirement/4bb709c2-e0e7-4af3-9f60-a045016a9610/comments",
      "Rel": "Comments"
    }
  ]
}

Status Code

200 - OK

Example - PUT (move requirement to new package)

Example of renaming a requirement.

Request Headers

KeyValueDescription
Acceptapplication/json
Content-typeapplication/json

Request Parameters

KeyValueDescription
{id}4bb709c2-e0e7-4af3-9f60-a045016a9610Unique identifier of the requirement to update.

Request Body

{ "PackageId": "daa396d6-ad7d-4acf-a6c5-40551a70f79" }

Response Headers

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

Response Body

{
  "Id": "4bb709c2-e0e7-4af3-9f60-a045016a9610",
  "Name": "Updated name",
  "AssignedToId": null,
  "AssignedTo": null,
  "Description": null,
  "PriorityId": "fe92720f-3fbd-4e49-a3b2-309f6a0a062a",
  "StatusId": "62daf195-0a65-400f-af4b-7fda3d529acb",
  "TypeId": "cfe51645-8179-4fe5-ada3-c145a64d0a05",
  "DifficultyLevelId": "47b4b0cc-22ee-4993-8ed5-ef1dec40a0d2",
  "CreatedAt": "2012-01-01T14:04:05Z",
  "LastUpdatedAt": "2012-02-02T15:05:06Z",
  "CreatedById": "191375f2-ae6e-4b52-8bed-4192e34b6486",
  "CreatedBy": "joeb",
  "LastUpdatedById": "191375f2-ae6e-4b52-8bed-4192e34b6486",
  "LastUpdatedBy": "joeb",
  "Number": 1,
  "EstimatedDuration": null,
  "PackageId": "daa396d6-ad7d-4acf-a6c5-40551a70f790",
  "ParentId": null,
  "OrderNumber": 0,
  "ProjectId": "27dcaff0-1f8a-4dff-b49a-bb3d9f7153b3",
  "ProjectName": "Test Project",
  "ParentName": null,
  "PackageName": "Cycle 3",
  "ChangeComment": null,
  "VersionNumber": 0,
  "HasAttachments": false,
  "Expands": [
    "FieldControls",
    "FieldValues",
    "Package"
  ],
  "Self": "http://localhost/api/requirement/4bb709c2-e0e7-4af3-9f60-a045016a9610",
  "Links": [
    {
      "Href": "http://localhost/api/requirement/4bb709c2-e0e7-4af3-9f60-a045016a9610/relationships",
      "Rel": "Relationships"
    },
    {
      "Href": "http://localhost/api/requirement/4bb709c2-e0e7-4af3-9f60-a045016a9610/allrelationships",
      "Rel": "AllRelationships"
    },
    {
      "Href": "http://localhost/api/requirement/4bb709c2-e0e7-4af3-9f60-a045016a9610/comments",
      "Rel": "Comments"
    }
  ]
}

Status Code

200 - OK

Example - PUT (generate new auto-number)

An example of updating a requirement with a new automatically generated value (if auto-number of requirements is enabled for the project this requirement belongs to).

Request Headers

KeyValueDescription
Acceptapplication/json
Content-typeapplication/json

Request Parameters

KeyValueDescription
{id}4bb709c2-e0e7-4af3-9f60-a045016a9610Unique identifier of the requirement to update.

Request Body

{ "Number": "auto" }

Response Headers

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

Response Body

{
  "Id": "4bb709c2-e0e7-4af3-9f60-a045016a9610",
  "Name": "Sample name",
  "AssignedToId": null,
  "AssignedTo": null,
  "Description": null,
  "PriorityId": "fe92720f-3fbd-4e49-a3b2-309f6a0a062a",
  "StatusId": "62daf195-0a65-400f-af4b-7fda3d529acb",
  "TypeId": "cfe51645-8179-4fe5-ada3-c145a64d0a05",
  "DifficultyLevelId": "47b4b0cc-22ee-4993-8ed5-ef1dec40a0d2",
  "CreatedAt": "2012-01-01T14:04:05Z",
  "LastUpdatedAt": "2012-02-02T15:05:06Z",
  "CreatedById": "191375f2-ae6e-4b52-8bed-4192e34b6486",
  "CreatedBy": "joeb",
  "LastUpdatedById": "191375f2-ae6e-4b52-8bed-4192e34b6486",
  "LastUpdatedBy": "joeb",
  "Number": 1234,
  "EstimatedDuration": null,
  "PackageId": "0f2c3a76-bbd1-4370-8faa-6aacb52f1a01",
  "ParentId": null,
  "OrderNumber": 0,
  "ProjectId": "27dcaff0-1f8a-4dff-b49a-bb3d9f7153b3",
  "ProjectName": "Test Project",
  "ParentName": null,
  "PackageName": "Cycle 1",
  "ChangeComment": null,
  "VersionNumber": 0,
  "HasAttachments": false,
  "Expands": [
    "FieldControls",
    "FieldValues",
    "Package"
  ],
  "Self": "http://localhost/api/requirement/4bb709c2-e0e7-4af3-9f60-a045016a9610",
  "Links": [
    {
      "Href": "http://localhost/api/requirement/4bb709c2-e0e7-4af3-9f60-a045016a9610/relationships",
      "Rel": "Relationships"
    },
    {
      "Href": "http://localhost/api/requirement/4bb709c2-e0e7-4af3-9f60-a045016a9610/allrelationships",
      "Rel": "AllRelationships"
    },
    {
      "Href": "http://localhost/api/requirement/4bb709c2-e0e7-4af3-9f60-a045016a9610/comments",
      "Rel": "Comments"
    }
  ]
}

Status Code

200 - OK

Example - PUT (full update)

Example of creating a new requirement with most of its fields populated (including custom fields).

Request Headers

KeyValueDescription
Acceptapplication/json
Content-typeapplication/json

Request Parameters

KeyValueDescription
{id}4bb709c2-e0e7-4af3-9f60-a045016a9610Unique identifier of the requirement to update.
$expandFieldValuesExpand field (we expand the FieldValues to ensure that it is returned in the response to create a new requirement).

Request Body

{
  "Id": "4bb709c2-e0e7-4af3-9f60-a045016a9610",
  "TemporaryId": "6cc26034-6514-44e0-907c-8f4f5eaa85b5",
  "PackageId": "0f2c3a76-bbd1-4370-8faa-6aacb52f1a01",
  "Number": 22,
  "Name": "Report pagination",
  "AssignedToId": "191375f2-ae6e-4b52-8bed-4192e34b6486",
  "EstimatedDuration": "5m",
  "PriorityId": "fe92720f-3fbd-4e49-a3b2-309f6a0a062a",
  "StatusId": "62daf195-0a65-400f-af4b-7fda3d529acb",
  "TypeId": "cfe51645-8179-4fe5-ada3-c145a64d0a05",
  "DifficultyLevelId": "47b4b0cc-22ee-4993-8ed5-ef1dec40a0d2",
  "Description": "derequiremention",
  "ChangeComment": "Requirement created updated via my API",
  "OrderNumber": 2,
  "FieldValues": {
    "Cycle": "V2.1 Cycle 1"
  }
}

Response Headers

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

Response Body

{
  "Id": "4bb709c2-e0e7-4af3-9f60-a045016a9610",
  "Name": "My New Requirement",
  "AssignedToId": "191375f2-ae6e-4b52-8bed-4192e34b6486",
  "AssignedTo": "joeb",
  "Description": "derequiremention",
  "PriorityId": "fe92720f-3fbd-4e49-a3b2-309f6a0a062a",
  "StatusId": "62daf195-0a65-400f-af4b-7fda3d529acb",
  "TypeId": "cfe51645-8179-4fe5-ada3-c145a64d0a05",
  "DifficultyLevelId": "47b4b0cc-22ee-4993-8ed5-ef1dec40a0d2",
  "CreatedAt": "2012-01-01T14:04:05Z",
  "LastUpdatedAt": "2012-02-02T15:05:06Z",
  "CreatedById": "191375f2-ae6e-4b52-8bed-4192e34b6486",
  "CreatedBy": "joeb",
  "LastUpdatedById": "191375f2-ae6e-4b52-8bed-4192e34b6486",
  "LastUpdatedBy": "joeb",
  "Number": 1,
  "EstimatedDuration": "5 minutes",
  "PackageId": "0f2c3a76-bbd1-4370-8faa-6aacb52f1a01",
  "ParentId": null,
  "OrderNumber": 22,
  "ProjectId": "27dcaff0-1f8a-4dff-b49a-bb3d9f7153b3",
  "ProjectName": "Test Project",
  "ParentName": null,
  "PackageName": "Cycle 1",
  "ChangeComment": "Requirement created updated via my API",
  "VersionNumber": 2,
  "HasAttachments": true,
  "Expands": [
    "FieldControls",
    "FieldValues",
    "Package"
  ],
  "Self": "http://localhost/api/requirement/4bb709c2-e0e7-4af3-9f60-a045016a9610",
  "Links": [
    {
      "Href": "http://localhost/api/requirement/4bb709c2-e0e7-4af3-9f60-a045016a9610/relationships",
      "Rel": "Relationships"
    },
    {
      "Href": "http://localhost/api/requirement/4bb709c2-e0e7-4af3-9f60-a045016a9610/allrelationships",
      "Rel": "AllRelationships"
    },
    {
      "Href": "http://localhost/api/requirement/4bb709c2-e0e7-4af3-9f60-a045016a9610/comments",
      "Rel": "Comments"
    }
  ]
}

Status Code

200 - OK

  • No labels