POST/projects/{ProjectId}/defects

Applies to QAComplete 14.5, last modified on August 06, 2024

Creates a new defect in QAComplete.

Use the operation to register a new defect in the specified project in QAComplete.

To update all the fields of a defect, use the …/defects/{Id} (PUT) operation. To update individual fields of a defect, use the …/defects/{Id} (PATCH) 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 Add privilege for Defects.

Request Format

To create a defect, send a POST request to the following URL:

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

ProjectId  :  integer, required

The ID of the project, to which you want to add a defect.

Body parameters

In the request body, pass the RequestDefectPost object that describes the defect to create.

{
  "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.

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. Default: 0.

ActStart  :  dateTime

Actual start date for defect fixing.

ActualResults  :  string

Actual outcome of actions performed when the defect was found. Can include HTML markup. Default value: empty string.

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. Default: 0.

EstHrsRemaining  :  float

Estimated remaining hours for defect fixing.

EstStart  :  dateTime

Estimated start date for working on the defect.

ExpectedResults  :  string

Expected results of the software if it did not have this defect. Can include HTML markup.

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.

HowFoundCode  :  string

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

IssueCode  :  string

The defect type 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. Default: 0.

PriorityCode  :  string

The defect priority.

Resolution  :  string

The defect’s resolution details. Can include HTML markup. Default value: empty string.

ResolutionCode  :  string

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

SeverityCode  :  string

The defect severity based on a choice list. Default value: empty string.

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. Default value: empty string.

A sample request:

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

{
  "Title": "Floating toolbar improvements",
  "Status": "New",
  "Description": "The design of the floating toolbar needs improvement so that it’s clearer what the user needs to do."
}

A sample request made by using cURL:

curl -u [email protected]:p@ssword -d @defect.txt -H "Content-Type: application/json" -H "Accept: application/json" http://yourserver.com/rest-api/service/api/v1/projects/11873/defects

Response Format

On success, the operation responds with HTTP status code 200. The response is a JSON object with information on the added defect.

A sample response:

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


{
  "id": 17,
  "title": "Floating toolbar improvements",
  "status": "New",
  "__permissions": {
    "acl": 7
  },
  "act_finish": "0001-01-01T00:00:00.0000000",
  "act_hrs": 0,
  "act_start": "0001-01-01T00:00:00.0000000",
  "assignee_user_id": 0,
  "closed_by": 0,
  "custom_fields": [],
  "date_closed": "0001-01-01T00:00:00.0000000",
  "date_created": "2015-09-07T00:52:27.0700000",
  "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-01-01T00:00:00.0000000",
  "est_hrs": 0,
  "est_hrs_remaining": 0,
  "est_start": "0001-01-01T00:00:00.0000000",
  "folder_id": 0,
  "import_id": 0,
  "nbr_events": 0,
  "nbr_files": 0,
  "nbr_notes": 0,
  "nbr_tasks": 0,
  "opened_by": 0,
  "opened_by_company": "EDGB",
  "opened_by_email": "[email protected]",
  "opened_by_name": "Smith, John",
  "original_id": 0,
  "owner_name": "Smith, John",
  "owner_user_id": 25264,
  "pct_complete": 0,
  "priority_code": " ",
  "project_id": 11873,
  "resolved_by": 0,
  "severity_code": " ",
  "update_user_id": 25264,
  "user_name": "Smith, John"
}

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.

See Also

Defects Resources

Highlight search results