PATCH/projects/{ProjectId}/defects/{Id}

Applies to QAComplete 12.70 SaaS, last modified on January 11, 2021

Updates a defect in QAComplete.

Use the operation to update the needed fields of an existing defect in QAComplete.

To update all the fields, use the …/defects/{Id} (PUT) operation.

To add a new defect, use the …/defects (POST) operation.

Authentication

Basic authentication using a user’s login and password. See Authentication for details.

Security Rights

The authenticating user must belong to a security group that has the Update privilege for Defects.

Request Format

To update the defect, send a PATCH request to the following URL:

http://{server}/rest-api/service/api/v1/projects/{ProjectId}/defects/{Id}
URL parameters

ProjectId  :  integer, required

The ID of the project, to which the defect belongs.

Id  :  integer, required

The ID of the defect, whose fields you want to update.

Body parameters

In the request body, pass the RequestDefectPatch JSON object that specifies the defect’s fields to update:

{
  "Title": "string",
  "Status": "string",
  "ActFinish": "Date",
  "ActHrs": "float",
  "ActStart": "Date",
  "ActualResults": "string",
  "AssigneeUserId": "int",
  "CustomFields": [
    {
      "Id": "string",
      "Name": "string",
      "Value": "string"
    }
  ],
  "Description": "string",
  "EstFinish": "Date",
  "EstHrs": "float",
  "EstHrsRemaining": "float",
  "EstStart": "Date",
  "ExpectedResults": "string",
  "FolderId": "int",
  "FunctionalAreaCode": "string",
  "HowFoundCode": "string",
  "IssueCode": "string",
  "ModuleCode": "string",
  "PctComplete": "int",
  "PriorityCode": "string",
  "Resolution": "string",
  "ResolutionCode": "string",
  "SeverityCode": "string",
  "SoftwareVersionCode": "string",
  "StepsToRepro": "string"
}

Some string property values (for example, Status) are based on choice lists defined in your QAComplete project. You can find these values in Defects > Show Defects > Actions > Manage Choice Lists in QAComplete.

The property values you do not specify remain unchanged.

Title  :  string, required

The defect title (subject).

Status  :  string, required

The defect status based on a choice list.

ActFinish  :  dateTime

Actual date when the defect was fixed.

ActHrs  :  float

Actual hours spent fixing the defect.

ActStart  :  dateTime

Actual start date for defect fixing.

ActualResults  :  string

Actual results of the defect as compared to the expected results. Can include HTML markup.

AssigneeUserId  :  integer

The ID of the user, to whom the defect is assigned. 0 if the defect is not assigned to anyone.

CustomFields  :  object

An array of CustomFields objects that describe custom fields and their values:


{
  "Id": "string",
  "Name": "string",
  "Value": "string"
}

Id  :  string, required

The unique identifier of the custom field. Must be in the CustomN format, where N is the custom field’s number (index).

Name  :  string

The field name.

Value  :  string

The field value.

Description  :  string

Long description of the defect. Can include HTML markup.

EstFinish  :  dateTime

Estimated finish date for defect fixing.

EstHrs  :  float

Estimated hours to fix the defect.

EstHrsRemaining  :  float

Estimated remaining hours for defect fixing.

ExpectedResults  :  string

Expected results of the software if it did not have this defect.

EstStart  :  dateTime

Estimated start date for working on the defect.

FolderId  :  integer

The ID of the folder containing the defect, or 0 if the defect is not in any folder.

FunctionalAreaCode  :  string

The functional area where the defect was found. This value is based on a choice list.

IssueCode  :  string

The defect type based on a choice list.

HowFoundCode  :  string

How the defect was found. This value is based on a choice list.

ModuleCode  :  string

The module where the defect was found. This value is based on a choice list.

PctComplete  :  integer

Percentage complete of defect fixing.

PriorityCode  :  string

The defect priority.

Resolution  :  string

The defect’s resolution details. Can include HTML markup.

ResolutionCode  :  string

The defect’s resolution status based on a choice list.

SeverityCode  :  string

The defect severity based on a choice list.

SoftwareVersionCode  :  string

The project version that the defect affects. This value is based on a choice list.

StepsToRepro  :  string

Steps to reproduce the defect. Can include HTML markup.

A sample request:

PATCH http://yourserver.com/rest-api/service/api/v1/projects/11873/defects/17 HTTP/1.1
Host: yourserver.com
Connection: keep-alive
Content-Type: application/json
Accept: application/json
Authorization: Basic am9obkBleGFtcGxlLmNvbTpwQHNzd29yZA==
Content-Length: 129

{
  "Title": "Floating toolbar improvements",
  "Status": "Active",
  "AssigneeUserId": "25264",
  "PriorityCode": "2-Fix Soon"
}

A sample request made by using cURL:

curl -u john@example.com:p@ssword -d @defect.txt -H "Content-Type: application/json" -H "Accept: application/json" http://yourserver.com/service/api/v1/projects/11873/defects/17

Response Format

On success, the operation responds with HTTP status code 200 and returns a JSON object with the updated defect information.

A sample response:

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Content-Length: 1198


{
  "id": 8,
  "title": "Floating toolbar improvements",
  "status": "Active",
  "__permissions": {
    "acl": 7
  },
  "act_finish": "0001-01-01T00:00:00.0000000",
  "act_hrs": 0,
  "act_start": "0001-12-30T00:00:00.0000000",
  "actual_results": "",
  "assigned_to_name": "Smith, John",
  "assignee_user_id": 25264,
  "closed_by": 0,
  "custom_fields": [],
  "date_created": "2015-09-07T00:52:27.0700000",
  "date_closed": "0001-01-01T00:00:00.0000000",
  "date_opened": "2015-09-07T00:52:27.0700000",
  "date_resolved": "0001-01-01T00:00:00.0000000",
  "date_updated": "2015-09-07T00:52:27.0700000",
  "description": "The design of the floating toolbar needs improvement so that it’s clearer what the user needs to do.",
  "est_finish": "0001-12-30T00:00:00.0000000",
  "est_hrs": 0,
  "est_hrs_remaining": 0,
  "est_start": "0001-12-30T00:00:00.0000000",
  "folder_id": 0,
  "import_id": 0,
  "opened_by": 0,
  "opened_by_company": "EDGB",
  "opened_by_email": "john.smith@edgb.com",
  "opened_by_name": "Smith, John",
  "original_id": 0,
  "owner_name": "Smith, John",
  "owner_user_id": 25264,
  "nbr_events": 0,
  "nbr_files": 0,
  "nbr_notes": 0,
  "nbr_tasks": 0,
  "pct_complete": 0,
  "priority_code": "2-Fix Soon",
  "project_id": 11873,
  "resolved_by": 0,
  "severity_code": " ",
  "user_name": "Smith, John",
  "update_user_id": 25264
}

Error responses

If the operation fails, it returns the appropriate status code and (optionally) the error description in the response body.

If the project with the specified ProjectId does not exist or the authenticating user does not have rights to access the project, the operation returns the Access is denied error.

If a defect with the specified Id does not exist, the operation returns the File or directory not found error.

See Also

Defects Resources

Highlight search results